You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spending some hours without finding a working solution I tried to load the js-url, tracker-url and site-id configuration from my REST API during custom Angular bootstrapping, then make it available to my modules via the $scope in order to be able to pass them to the ngp-piwik directive within the html...
The idea behind: Being able to have different js-url, tracker-url and site-id per environment.
More in detail I am using a deferred bootstrapper:
/**
* The deferred boot strapper loading config from the back-end before bootstrapping
* the app.
*/
window.deferredBootstrapper.bootstrap({
element: window.document.body,
module: 'myApp',
resolve: {
environmentConfig: ['$http', function ($http) {
return $http.get('/rest/skin/environmentConfig');
}]
},
onError: function (error) {
console.error("Failed to bootstrap, error: " + error)
}
});
And while doing the following I can also see in the console output that the JSON config has been loaded successfully:
angular.module('bepraxis')
.config(function (environmentConfig) {
console.log('APP_CONFIG is: ' + JSON.stringify(environmentConfig));
})
The problem I am running into is the asynchronous part during boot strapping or lets say the config is not available at the moment when the ngp-piwik directive is being injected...
So my question: Has anyone out in the wild faced a similar situation where the analytics server url and site ID could not be hard coded but instead per environment configuration was required?
Thanks a lot in advance for your valuable support.
Best,
Simon
The text was updated successfully, but these errors were encountered:
Hi everybody,
Spending some hours without finding a working solution I tried to load the js-url, tracker-url and site-id configuration from my REST API during custom Angular bootstrapping, then make it available to my modules via the $scope in order to be able to pass them to the ngp-piwik directive within the html...
The idea behind: Being able to have different js-url, tracker-url and site-id per environment.
Example:
More in detail I am using a deferred bootstrapper:
And while doing the following I can also see in the console output that the JSON config has been loaded successfully:
The problem I am running into is the asynchronous part during boot strapping or lets say the config is not available at the moment when the ngp-piwik directive is being injected...
So my question: Has anyone out in the wild faced a similar situation where the analytics server url and site ID could not be hard coded but instead per environment configuration was required?
Thanks a lot in advance for your valuable support.
Best,
Simon
The text was updated successfully, but these errors were encountered: