Change @Input handling.
This commit is contained in:
parent
8eaa3b9039
commit
8b63a9d5df
@ -2,11 +2,7 @@
|
||||
|
||||
import * as moment from 'moment';
|
||||
|
||||
import {
|
||||
Component, ViewChild,
|
||||
Inject, Input, Output, EventEmitter,
|
||||
OnInit, OnChanges
|
||||
} from '@angular/core';
|
||||
import { Component, ViewChild, Input, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router, ParamMap } from '@angular/router';
|
||||
|
||||
import { Logger } from '@nsalaun/ng-logger';
|
||||
@ -32,8 +28,8 @@ import { DailyBalanceService } from '../accounts/dailyBalance.service';
|
||||
</jqxChart>
|
||||
`
|
||||
})
|
||||
export class BalanceChartComponent implements OnInit, OnChanges {
|
||||
@Input() account: Account;
|
||||
export class BalanceChartComponent implements OnInit {
|
||||
private _account: Account;
|
||||
@ViewChild('balanceChart') chart: jqxChartComponent;
|
||||
|
||||
public data;
|
||||
@ -168,10 +164,15 @@ export class BalanceChartComponent implements OnInit, OnChanges {
|
||||
this.loadData();
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
if('account' in changes && changes.account.currentValue) {
|
||||
this.setLines(changes.account.currentValue);
|
||||
@Input()
|
||||
set account(account: Account) {
|
||||
this._account = account;
|
||||
|
||||
this.setLines(account);
|
||||
}
|
||||
|
||||
get account(): Account {
|
||||
return this._account;
|
||||
}
|
||||
|
||||
updateXBands(minDate, maxDate) {
|
||||
|
Loading…
Reference in New Issue
Block a user