我有问题ngStorage。当我使用我的工厂jQuery的$ajax
,我不能使用$localStorage
.then()
(它不工作)。
$scope.updateProfile = function() {
updateProfileFactory.init($scope.dataProfile).then(
function (data)
if (data.status == "success") {
$localStorage.currentUser.fullname = $scope.dataProfile.u_fullname;
}
}
)
}
如果我使用$localStorage
外.then()
,它的工作的罚款,但我必须把它放在里面。
$scope.updateProfile = function() {
$localStorage.currentUser.fullname = $scope.dataProfile.u_fullname;
updateProfileFactory.init($scope.dataProfile).then(
function (data) {
if (data.status == "success") {
// code
}
}
)
}
问题在哪里?
请尽量定义“不起作用”。你可以调试,看看'then'函数是否曾被称为? –