angular绑定JSON数组
如下所示,如果$scope.equipments=...那一段,放在$.post里就不能绑定到$scope.equipments上,如果放在外面就可以,这是为什么?
mainApp.controller('equipmentsController', function($scope, $http) {
$.post("getAllDeviceList.action",
{},
function(response){
$scope.equipments = [ {
"id" : "1",
"name" : "equipment01 ",
"number" : "11"
}, {
"id" : "2",
"name" : "equipment02 ",
"number" : "22"
}, {
"id" : "3",
"name" : "equipment03 ",
"number" : "33"
} ];
}
);
$scope.equipments = [ {
"id" : "1",
"name" : "equipment01 ",
"number" : "11"
}, {
"id" : "2",
"name" : "equipment02 ",
"number" : "22"
}, {
"id" : "3",
"name" : "equipment03 ",
"number" : "33"
} ];
}
4⑨5年D波紋
9 years, 10 months ago