【发布时间】:2013-07-19 21:11:54
【问题描述】:
这是我的控制器:
function TestCtrl ($scope, sharedProperties, $resource){
var userDataProfile = sharedProperties.getUserDataProfile();
var userCreatedBoard = $resource('/boards?owner=:owner');
userCreatedBoard.query({'owner':userDataProfile.id}, function (result) {
console.log(result);
});
}
现在的问题是 sharedProperties.setUserDataProfile() 在调用 3rd 方服务及其异步之后被调用。因此,当绑定TestCtrl 时,userDataProfile 实际上为空。我该如何处理这种情况,以便在调用 sharedProperties.setUserDataProfile() 并从 3rd 方服务为变量分配一个值之后,只有我的控制器应该被绑定?
【问题讨论】:
-
你在使用 $routeprovider 吗??
标签: javascript jquery html angularjs