【发布时间】:2016-12-11 05:48:02
【问题描述】:
我有主控制器:
.controller('mainCtrl', ['$scope', '$rootScope', 'Data', '$http', '$log', '$filter', '$q', '$timeout', function($scope, $rootScope, Data, $http, $log, $filter, $q, $timeout){
Data.get('customers').then(function(data){
$scope.customers = data.data;
$rootScope.language = data.data[0].language;
});
$rootScope.word_pub_curr_lang = 'word_pub_' + $rootScope.language;
console.log('from maincrtl', $rootScope.word_pub_curr_lang);
}]);
问题是我无法接收 $rootScope.word_pub_curr_lang 或 $rootScope.language - 始终未定义。
【问题讨论】:
标签: angularjs asynchronous scope rootscope