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/server-control/controllers/power-usage-controller.js b/app/server-control/controllers/power-usage-controller.js
index 5dc848e..9398259 100644
--- a/app/server-control/controllers/power-usage-controller.js
+++ b/app/server-control/controllers/power-usage-controller.js
@@ -10,8 +10,8 @@
'use strict';
angular.module('app.serverControl').controller('powerUsageController', [
- '$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.power_consumption = '';
$scope.power_cap = {};
$scope.loading = false;
@@ -49,7 +49,8 @@
$scope.setPowerCap = function() {
// The power cap value will be undefined if outside range
if (!$scope.power_cap.PowerCap) {
- ngToast.danger('Power cap value between 100 and 10,000 is required');
+ toastService.error(
+ 'Power cap value between 100 and 10,000 is required');
return;
}
$scope.loading = true;
@@ -61,10 +62,10 @@
$q.all(promises)
.then(
function() {
- ngToast.success('Power cap settings saved');
+ toastService.success('Power cap settings saved');
},
function(errors) {
- ngToast.danger('Power cap settings could not be saved');
+ toastService.error('Power cap settings could not be saved');
})
.finally(function() {
$scope.loading = false;