mirror of
https://github.com/Febbweiss/CloudBudget-AngularJS.git
synced 2026-03-04 22:35:38 +00:00
Feature: add growl for notification
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
var HOST = 'http://cloudbudget-febbweiss.c9.io/api';
|
||||
|
||||
angular
|
||||
.module('cloudbudget', ['ngRoute', 'routes', 'ngCookies', 'xeditable'])
|
||||
.module('cloudbudget', ['ngRoute', 'ngAnimate', 'routes', 'angular-growl', 'config', 'ngCookies', 'xeditable'])
|
||||
.constant('apiRoutes', {
|
||||
'host' : HOST,
|
||||
'port' : "80",
|
||||
|
||||
15
public/js/config.js
Normal file
15
public/js/config.js
Normal file
@@ -0,0 +1,15 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('config', [])
|
||||
.config(config);
|
||||
|
||||
config.$inject = ['growlProvider'];
|
||||
|
||||
function config(growlProvider) {
|
||||
growlProvider.globalReversedOrder(true);
|
||||
growlProvider.globalTimeToLive(5000);
|
||||
growlProvider.globalDisableCountDown(true);
|
||||
};
|
||||
})();
|
||||
@@ -6,8 +6,9 @@
|
||||
.config(config);
|
||||
|
||||
config.$inject = ['$routeProvider', '$locationProvider'];
|
||||
|
||||
|
||||
function config($routeProvider, $locationProvider) {
|
||||
|
||||
$routeProvider
|
||||
.when('/', {
|
||||
controller: 'HomeController',
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
.module('cloudbudget')
|
||||
.factory('FlashService', FlashService);
|
||||
|
||||
FlashService.$inject = ['$rootScope'];
|
||||
FlashService.$inject = ['$rootScope', 'growl'];
|
||||
|
||||
function FlashService($rootScope) {
|
||||
function FlashService($rootScope, growl) {
|
||||
var service = {};
|
||||
|
||||
service.success = success;
|
||||
@@ -35,19 +35,11 @@
|
||||
}
|
||||
|
||||
function success(message, keepAfterLocationChange) {
|
||||
$rootScope.flash = {
|
||||
message: message,
|
||||
type: 'success',
|
||||
keepAfterLocationChange: keepAfterLocationChange
|
||||
};
|
||||
growl.success(message,{title: 'Success!'});
|
||||
}
|
||||
|
||||
function error(message, keepAfterLocationChange) {
|
||||
$rootScope.flash = {
|
||||
message: message,
|
||||
type: 'error',
|
||||
keepAfterLocationChange: keepAfterLocationChange
|
||||
};
|
||||
growl.error(message, {title: 'Error!'});
|
||||
}
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user