<button class="button button-primary"
ng-click="editSchedule(controlCenter.selected)">
Edit Schedule
</button>
我从Button调用函数
$scope.records = [];
$scope.editSchedule = function(data) {
var s = "/api/v1/controlcenter/sitegroups?";
for (var i = 0; i < data.length - 1; i++) {
s += "ids=" + data[i]._id + "&";
}
s += "ids=" + data[data.length - 1]._id;
$http({
method: "GET",
url:s,
}).then(
function successCallback(response) {
$scope.records = response.data;
console.log("angular api call");
console.log($scope.records);
},
function errorCallback(response) {
alert("Error. Try Again!");
}
);
};
我正在获得Api响应,但没有在$ scope.records变量中对其进行更新。
答案 0 :(得分:0)
确保您的视图与$scope.records
处于同一范围内,这一定很愚蠢!好像您的控制器和您的视图不一样。