Greetings, I am currently working with an angular.js controller that looks like this.
function WorkSpacesController($scope, $http, notifications) {
$scope.Workspaces = [];
$scope.Query = "";
$http.get("api/Workspaces/GetAllWorkspaces/").then(function(response) {
for (var i = 0; i < response.data.length; i++) {
$scope.Workspaces.push(response.data[i]);
notifications.showSuccess("Added new Item");
}
},
function(data) {
notifications.showError("Could not load workspaces");
});
}
The notifications.showSuccess
and notifications.showError
functions are responsible for displaying notifications on the screen. These functions are implemented using https://github.com/alexbeletsky/ng-notifications-bar.
What's interesting is that the showSuccess
function works perfectly and displays the notification as expected. However, the showError
function does not seem to work at all and nothing is displayed. I have checked the code thoroughly, added messages to the array, and no errors are reported. Just to double-check, I even tried calling showError
instead of showSuccess
, and surprisingly it worked fine.
Any ideas why the user interface fails to update when showError
is called?