diff --git a/src/main.less b/src/main.less index dc244c4..3f83abc 100644 --- a/src/main.less +++ b/src/main.less @@ -1,6 +1,5 @@ @import '~font-awesome/less/font-awesome'; -@import '~angular-ui-notification/src/angular-ui-notification'; @import (inline) '~c3/c3.css'; diff --git a/src/operations/index.ts b/src/operations/index.ts index b4fe981..e096a00 100644 --- a/src/operations/index.ts +++ b/src/operations/index.ts @@ -22,9 +22,14 @@ var moment = require('moment'); var angular = require('angular'); +import { + downgradeInjectable, +} from '@angular/upgrade/static'; + +import { ToastrService } from 'ngx-toastr'; + var ngResource = require('angular-resource'), ngMessages = require('angular-messages'), - ngUiNotification = require('angular-ui-notification'), ngStrap = require('angular-strap'); var balanceChartModule = require('./balance-chart.component'), @@ -38,13 +43,14 @@ var OperationController = require('./operation.controller'); export default angular.module('accountant.operations', [ ngResource, ngMessages, - ngUiNotification, ngStrap, accountModule, balanceChartModule, categoryChartModule ]) + .factory('toastrService', downgradeInjectable(ToastrService)) + .factory('Operation', OperationFactory) .controller('OperationController', OperationController) diff --git a/src/operations/operation.controller.ts b/src/operations/operation.controller.ts index ea8dd7e..e294a08 100644 --- a/src/operations/operation.controller.ts +++ b/src/operations/operation.controller.ts @@ -1,7 +1,7 @@ var operationFormTmpl = require('./operation.form.tmpl.html'), operationDeleteTmpl = require('./operation.delete.tmpl.html'); -module.exports = function($stateParams, $modal, Notification, Operation, +module.exports = function($stateParams, $modal, toastrService, Operation, AccountService) { var vm = this; @@ -58,13 +58,13 @@ module.exports = function($stateParams, $modal, Notification, Operation, operation.confirmed = true; return operation.$save().then(function(operation) { - Notification.success('Operation #' + operation.id + ' saved.'); + toastrService.success('Operation #' + operation.id + ' saved.'); vm.operations = vm.load(); return operation; }, function(result){ - Notification.error( + toastrService.error( 'Error while saving operation: ' + result.message ); }); @@ -98,13 +98,13 @@ module.exports = function($stateParams, $modal, Notification, Operation, var id = operation.id; return operation.$delete().then(function() { - Notification.success('Operation #' + id + ' deleted.'); + toastrService.success('Operation #' + id + ' deleted.'); vm.operations = vm.load(); return operation; }, function(result) { - Notification.error( + toastrService.error( 'An error occurred while trying to delete operation #' + id + ':
' + result );