??? ?? $scope.equipments=... ??? $.post? ??? $scope.equipments? ???? ? ????. ? ?????
????光陰似箭催人老,日月如移越少年。
@lee1994522?? ??? ?? ? $.post ???? ???? ? Angle? ????
? ????? Angle? $scope? ???? ? ??? ?? ??????. 脫離了angular的上下文
,所以無(wú)法綁定到angular的$scope里。
this is the point,pls.. $.post is not an Angular issue and the stuff
it wraps is not in an Angular world,so it's obviously that the
equipments outside is in Angular's world and it works as you expecttry $scope.$apply() when you call a "none Angular" issue if you wanna
refresh sth
解決辦法有兩個(gè):
第一個(gè)誠(chéng)如@lee1994522所說(shuō),直接在$.post的回調(diào)函數(shù)的最后加上一句$scope.$apply()
? ?? ???? ????:
$.???
? ??? @lee1994522? ???? $.post ?? ?? ??
$scope.$apply()
??? ?? ???? ?? ??? ?? ????? ????? ??????
???
??$http.post??
??AngularJS - $http.post? JSON ?? ?? ????? ??? ????
???? ??: ??
???
???? ?? ????? ??? ?????. ??
????? ???? $.post ??? ??? ? ????. $http
? ???? ??? ??????Your$.post
不是angular
的方法,所以實(shí)際上post的回調(diào)雖然執(zhí)行了,但angular
在視圖上卻不知道這件事。你可以在$.post
里的賦值操作后面再跟一句$scope.$apply();
, ?? ?? ??? ?????.