Use new Logger in account module.
This commit is contained in:
parent
de945cd16c
commit
3e6b1ecccc
@ -1,5 +1,7 @@
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
import { Logger } from '@nsalaun/ng-logger';
|
||||
|
||||
var accountFormTmpl = require('./account.form.tmpl.html'),
|
||||
accountDeleteTmpl = require('./account.delete.tmpl.html');
|
||||
|
||||
@ -9,7 +11,7 @@ import { AccountService } from './account.service';
|
||||
import { AccountBalancesService } from './accountBalances.service';
|
||||
|
||||
export class AccountComponent {
|
||||
static $inject = ['AccountService', 'AccountBalancesService', 'Notification', '$log', '$modal'];
|
||||
static $inject = ['AccountService', 'AccountBalancesService', 'Notification', 'Logger', '$modal'];
|
||||
|
||||
accounts: Account[];
|
||||
|
||||
@ -17,7 +19,7 @@ export class AccountComponent {
|
||||
private AccountService: AccountService,
|
||||
private AccountBalancesService: AccountBalancesService,
|
||||
private Notification,
|
||||
private $log,
|
||||
private Logger: Logger,
|
||||
private $modal
|
||||
) {
|
||||
// Load accounts.
|
||||
@ -61,6 +63,7 @@ export class AccountComponent {
|
||||
load() {
|
||||
this.AccountService.query().subscribe(accounts => {
|
||||
this.accounts = accounts.map((account: Account) => {
|
||||
this.Logger.log(account);
|
||||
this.AccountBalancesService
|
||||
.get(account.id)
|
||||
.subscribe((accountBalances: AccountBalances) => {
|
||||
@ -95,7 +98,7 @@ export class AccountComponent {
|
||||
|
||||
this.load();
|
||||
}, result => {
|
||||
this.$log.error('Error while saving account', account, result);
|
||||
this.Logger.error('Error while saving account', account, result);
|
||||
|
||||
this.Notification.error(
|
||||
'Error while saving account: ' + result.message
|
||||
@ -157,7 +160,7 @@ export class AccountComponent {
|
||||
|
||||
this.$modal({
|
||||
templateUrl: accountFormTmpl,
|
||||
controller: function($log, $scope, title, account, $save) {
|
||||
controller: function($scope, title, account, $save) {
|
||||
$scope.title = title;
|
||||
$scope.account = account;
|
||||
$scope.account.authorized_overdraft *= -1;
|
||||
|
@ -27,6 +27,8 @@ var ngResource = require('angular-resource'),
|
||||
ngUiNotification = require('angular-ui-notification'),
|
||||
ngStrap = require('angular-strap');
|
||||
|
||||
import { Logger } from '@nsalaun/ng-logger';
|
||||
|
||||
var accountsTmpl = require('./accounts.html');
|
||||
|
||||
import { AccountBalancesService } from './accountBalances.service';
|
||||
@ -40,6 +42,8 @@ export default angular.module('accountant.accounts', [
|
||||
ngStrap,
|
||||
])
|
||||
|
||||
.factory('Logger', downgradeInjectable(Logger))
|
||||
|
||||
.factory('AccountBalancesService', downgradeInjectable(AccountBalancesService))
|
||||
|
||||
.factory('AccountService', downgradeInjectable(AccountService))
|
||||
|
Loading…
Reference in New Issue
Block a user