Files
openaccounting-web/src/app/transaction/breadcrumbs.ts

25 lines
572 B
TypeScript
Raw Normal View History

2018-10-19 11:28:08 -04:00
import { Component, Input } from '@angular/core';
import { Account } from '../shared/account';
@Component({
selector: 'breadcrumbs',
templateUrl: 'breadcrumbs.html',
styleUrls: ['./breadcrumbs.scss']
})
export class Breadcrumbs {
@Input() account: Account;
public accountCrumbs: Account[];
constructor() {
this.accountCrumbs = [];
}
ngOnInit() {
let currentAccount = this.account;
while(currentAccount && currentAccount.depth > 0) {
this.accountCrumbs.unshift(currentAccount);
currentAccount = currentAccount.parent;
}
}
}