2
我遵循ui-router wiki有關使用resolves的說明。如果我按照wiki上的說明操作,則可以將值分享給控制器而不會出現問題,如果通過引用包含控制器,則值未定義。我錯過了什麼?有角度的UI路由器解析數據得到undefined
.state('intro', {
url: '/',
resolve:{
resA: function(){
return {'value': 'A'};
}
},
views: {
'content': {
templateUrl: 'views/home.html',
controller: function($scope, resA){
$scope.resA = resA.value;
}
},
'navigation': {
templateUrl: 'views/navigation.html'
}
} })
.controller('introController', ['$scope', function($scope,resA) {
$scope.resA = resA.value; //undefined
哦男人。謝謝。 – Jimi 2014-09-27 05:48:35