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/network-controller.js b/app/configuration/controllers/network-controller.js
index 8a92ef4..d2d99ba 100644
--- a/app/configuration/controllers/network-controller.js
+++ b/app/configuration/controllers/network-controller.js
@@ -11,9 +11,10 @@
angular.module('app.configuration').controller('networkController', [
'$scope', '$window', 'APIUtils', 'dataService', '$timeout', '$route', '$q',
- 'ngToast',
+ 'toastService',
function(
- $scope, $window, APIUtils, dataService, $timeout, $route, $q, ngToast) {
+ $scope, $window, APIUtils, dataService, $timeout, $route, $q,
+ toastService) {
$scope.dataService = dataService;
$scope.network = {};
$scope.oldInterface = {};
@@ -98,7 +99,7 @@
for (var i in $scope.interface.ipv4.values) {
if (!APIUtils.validIPV4IP(
$scope.interface.ipv4.values[i].Address)) {
- ngToast.danger(
+ toastService.error(
$scope.interface.ipv4.values[i].Address +
' invalid IP parameter');
$scope.loading = false;
@@ -106,7 +107,7 @@
}
if (!APIUtils.validIPV4IP(
$scope.interface.ipv4.values[i].Gateway)) {
- ngToast.danger(
+ toastService.error(
$scope.interface.ipv4.values[i].Address +
' invalid gateway parameter');
$scope.loading = false;
@@ -114,7 +115,7 @@
}
// The netmask prefix length will be undefined if outside range
if (!$scope.interface.ipv4.values[i].PrefixLength) {
- ngToast.danger(
+ toastService.error(
$scope.interface.ipv4.values[i].Address +
' invalid Prefix Length parameter');
$scope.loading = false;
@@ -152,12 +153,12 @@
$timeout(function() {
loadNetworkInfo();
$scope.loading = false;
- ngToast.success('Network settings saved');
+ toastService.success('Network settings saved');
}, 4000);
},
function(error) {
$scope.loading = false;
- ngToast.danger('Network settings could not be saved');
+ toastService.error('Network settings could not be saved');
})
} else {
$scope.loading = false;