我正在设置配置参数,但console.log()
返回给我undefined
,我不明白为什么,我在控制台中看到从 http 调用返回的 json !!!
app.run(function($rootScope, $location,$http){
var update = function (){
$rootScope.config = {};
$rootScope.config.app_name = "Appname";
$rootScope.config.app_short_description = $rootScope.config.app_name+" helps you go out with your rabbit";
$rootScope.config.app_motto = "hey ohhhhhhhhhh <i class='icon-check'></i>";
$rootScope.config.app_url = $location.url();
$rootScope.config.app_path = $location.path();
$http.get('jsons/json.json').success(function(response) {
$rootScope.config.app_genres = response.data;
});
console.log($rootScope.config.app_genres);
}
$rootScope.$on('$routeChangeStart', function(){
update();
});
});