Add role alert to toasts
For accessibility reasons, 'role="alert" is required for toast
messages. This notifies screen readers that an error or success
message has appeared. Adds a service layer for toast messages
that adds the role attribute to the message.
Change-Id: Ic4dbf5556337eea589de5692c1b4c3323e771813
Signed-off-by: beccabroek <beccabroek@gmail.com>
diff --git a/app/configuration/controllers/snmp-controller.js b/app/configuration/controllers/snmp-controller.js
index 4ad0685..9d71765 100644
--- a/app/configuration/controllers/snmp-controller.js
+++ b/app/configuration/controllers/snmp-controller.js
@@ -10,8 +10,8 @@
'use strict';
angular.module('app.configuration').controller('snmpController', [
- '$scope', '$window', 'APIUtils', '$route', '$q', 'ngToast',
- function($scope, $window, APIUtils, $route, $q, ngToast) {
+ '$scope', '$window', 'APIUtils', '$route', '$q', 'toastService',
+ function($scope, $window, APIUtils, $route, $q, toastService) {
$scope.managers = [];
$scope.loading = true;
$scope.managersToDelete = [];
@@ -31,7 +31,7 @@
}
},
function(error) {
- ngToast.danger('Unable to load SNMP settings.');
+ toastService.error('Unable to load SNMP settings.');
console.log(JSON.stringify(error));
});
@@ -74,7 +74,7 @@
if (!$scope.managers[i].address || !$scope.managers[i].port) {
// TODO: Highlight the field that is empty
$scope.loading = false;
- ngToast.danger('All fields are required.');
+ toastService.error('All fields are required.');
return;
}
@@ -104,10 +104,10 @@
$q.all(promises)
.then(
function() {
- ngToast.success('SNMP Managers set.');
+ toastService.success('SNMP Managers set.');
},
function(errors) {
- ngToast.danger('Unable to set SNMP Managers.');
+ toastService.error('Unable to set SNMP Managers.');
console.log(JSON.stringify(errors));
})
.finally(function() {