Rename dependencies.
This commit is contained in:
parent
f9c2e7f4bc
commit
adec1f102e
@ -47,10 +47,10 @@ export class AccountListComponent implements OnInit {
|
|||||||
accounts: Account[];
|
accounts: Account[];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private AccountService: AccountService,
|
private accountService: AccountService,
|
||||||
private ToastrService: ToastrService,
|
private toastrService: ToastrService,
|
||||||
private Logger: Logger,
|
private logger: Logger,
|
||||||
private NgbModal: NgbModal
|
private ngbModal: NgbModal
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,8 @@ export class AccountListComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
load() {
|
load() {
|
||||||
this.AccountService.query().subscribe(accounts => {
|
this.logger.log("Load accounts.");
|
||||||
|
this.accountService.query().subscribe(accounts => {
|
||||||
this.accounts = accounts;
|
this.accounts = accounts;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -69,14 +70,14 @@ export class AccountListComponent implements OnInit {
|
|||||||
* Add an empty account.
|
* Add an empty account.
|
||||||
*/
|
*/
|
||||||
add() {
|
add() {
|
||||||
const modal = this.NgbModal.open(AccountEditModalComponent, {
|
const modal = this.ngbModal.open(AccountEditModalComponent, {
|
||||||
windowClass: 'in'
|
windowClass: 'in'
|
||||||
});
|
});
|
||||||
|
|
||||||
modal.componentInstance.account = new Account();
|
modal.componentInstance.account = new Account();
|
||||||
|
|
||||||
modal.result.then((account: 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);
|
this.save(account);
|
||||||
}, (reason) => function(reason) {
|
}, (reason) => function(reason) {
|
||||||
});
|
});
|
||||||
@ -86,14 +87,14 @@ export class AccountListComponent implements OnInit {
|
|||||||
* Save account.
|
* Save account.
|
||||||
*/
|
*/
|
||||||
save(account) {
|
save(account) {
|
||||||
this.AccountService.create(account).subscribe(account => {
|
this.accountService.create(account).subscribe(account => {
|
||||||
this.ToastrService.success('Account #' + account.id + ' saved.');
|
this.toastrService.success('Account #' + account.id + ' saved.');
|
||||||
|
|
||||||
this.load();
|
this.load();
|
||||||
}, result => {
|
}, 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
|
'Error while saving account: ' + result.message
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user