<button class="button button-primary"
ng-click="updateSchedule(controlCenter.selected)">
Update Schedule
</button>
Calling the updateSchedule function from the button
$scope.data = [];
$scope.updateSchedule = function(selectedData) {
var url = "/api/v1/controlcenter/locations?";
for (var i = 0; i < selectedData.length - 1; i++) {
url += "ids=" + selectedData[i]._id + "&";
}
url += "ids=" + selectedData[selectedData.length - 1]._id;
$http({
method: "GET",
url: url,
}).then(
function successCallback(response) {
$scope.data = response.data;
console.log("API call successful");
console.log($scope.data);
},
function errorCallback(response) {
alert("Error. Please try again!");
}
);
};
The API response is received, but it is not updating the $scope.data variable.