I have a 'notifications app' in my program. In the app there is an 'notices' section. Each notice has an option to delete the notice with a delete button on that row. The 'notices' section also has a clear button. I want to make that clear button delete all of the notices in the 'notices' section. However I am having trouble doing this.
CONTROLLER
(function () {
'use strict';
angular
.module('notifications')
.controller('NotificationsCtrl', NotificationsCtrl);
function NotificationsCtrl($scope, $state, SecService, Service, RecService) {
var vm = this;
vm.ctrlName = 'NotificationsCtrl';
$scope.showAppsMenu = false;
$scope.appList = {};
$scope.dismissNotification = function(notification) {
EcosystemService.dismissNotification(notification.id).then(
function (response) {
delete $scope.appList[notification.appId].notifications[notification.id];
});
};
$scope.dismissAppNotifications = function(app) {
var notifications = app.notifications;
for (var i = 0; i < notifications.length; i++) {
EcosystemService.dismissNotification(notifications[i].id).then(
function(index) {
return function (response) {
delete app.notifications[index];
}
}(i));
}
};
I need to make a change in $scope.dismissAppNotifications. I am just stumped on what I need to add. The 'alerts' are not being cleared still. I added where the Service is being used. Maybe I need to add something here as well?