I have 3 json files to build the front-end of my web app:
- config.json to get all options based on the user rights
- preferences.json which is the user preferences
- foo.json which is the object that the user will modify thanks the web app
In my main controller, config or Run (I don't know what is the best way), I would like to load all this json and store them in the $rootScope to build all instances of my components in the HTML page.
I already tried to do this...
$http.get('config/config.json').success(function(configResponse) {
$rootScope.config = configResponse;
});
$http.get('preferences/preferences.json').success(function(prefResponse) {
$rootScope.preferences = configResponse;
});
$http.get('foo/foo.json').success(function(fooResponse) {
$rootScope.foo = fooResponse;
});
console.dir($rootScope);
Unfortunately, that does not work. Someone has an idea and the best way to do it in Angular 1.5 which will facilitate the transition in Angular 2.0 ?