Rename dependencies.

This commit is contained in:
Alexis Lahouze 2017-07-22 08:42:17 +02:00
parent f9c2e7f4bc
commit adec1f102e

View File

@ -47,10 +47,10 @@ export class AccountListComponent implements OnInit {
accounts: Account[];
constructor(
private AccountService: AccountService,
private ToastrService: ToastrService,
private Logger: Logger,
private NgbModal: NgbModal
private accountService: AccountService,
private toastrService: ToastrService,
private logger: Logger,
private ngbModal: NgbModal
) {
}
@ -60,7 +60,8 @@ export class AccountListComponent implements OnInit {
}
load() {
this.AccountService.query().subscribe(accounts => {
this.logger.log("Load accounts.");
this.accountService.query().subscribe(accounts => {
this.accounts = accounts;
});
};
@ -69,14 +70,14 @@ export class AccountListComponent implements OnInit {
* Add an empty account.
*/
add() {
const modal = this.NgbModal.open(AccountEditModalComponent, {
const modal = this.ngbModal.open(AccountEditModalComponent, {
windowClass: 'in'
});
modal.componentInstance.account = new Account();
modal.result.then((account: Account) => {
this.Logger.log("Modal closed => save account", account);
this.logger.log("Modal closed => save account", account);
this.save(account);
}, (reason) => function(reason) {
});
@ -86,14 +87,14 @@ export class AccountListComponent implements OnInit {
* Save account.
*/
save(account) {
this.AccountService.create(account).subscribe(account => {
this.ToastrService.success('Account #' + account.id + ' saved.');
this.accountService.create(account).subscribe(account => {
this.toastrService.success('Account #' + account.id + ' saved.');
this.load();
}, result => {
this.Logger.error('Error while saving account', account, result);
this.logger.error('Error while saving account', account, result);
this.ToastrService.error(
this.toastrService.error(
'Error while saving account: ' + result.message
);
});