1/**
2 * data service
3 *
4 * @module app/common/services/toastService
5 * @exports toastService
6 * @name toastService
7
8 */
9
10window.angular && (function(angular) {
11  'use strict';
12
13  angular.module('app.common.services').service('toastService', [
14    'ngToast', '$sce',
15    function(ngToast, $sce) {
16      this.error = function(message) {
17        var errorMessage = $sce.trustAsHtml(
18            '<div role="alert"><b>Error</b><br>' + message + '</div>');
19        ngToast.create({className: 'danger', content: errorMessage});
20      };
21      this.success = function(message) {
22        var successMessage = $sce.trustAsHtml(
23            '<div role="alert"><b>Success!</b><br>' + message + '</div>');
24        ngToast.create({className: 'success', content: successMessage});
25      };
26    }
27  ]);
28})(window.angular);
29