calculate after creatr

This commit is contained in:
Artur 2024-11-04 23:03:27 +01:00
parent 9ec4e43ecf
commit fb175d66ff
1 changed files with 2 additions and 1 deletions

View File

@ -41,12 +41,13 @@ export class AssetCalculatorComponent implements OnInit, OnDestroy{
constructor(private assetService : AssetService ){ constructor(private assetService : AssetService ){
this.assetsDepreciationFormGroup.valueChanges.subscribe( (value) => this.calculate() ); this.assetsDepreciationFormGroup.valueChanges.subscribe( (value) => this.calculate() );
this.lifeFormArray.valueChanges.subscribe( (value) => this.calculate() ); this.lifeFormArray.valueChanges.subscribe( (value) => this.calculate() );
} }
ngOnInit(): void{ ngOnInit(): void{
const savedAsset = localStorage.getItem('assetForCalculator'); const savedAsset = localStorage.getItem('assetForCalculator');
if (savedAsset) this.assetToControls(JSON.parse(savedAsset)); if (savedAsset) this.assetToControls(JSON.parse(savedAsset));
this.calculate();
} }
ngOnDestroy(): void { ngOnDestroy(): void {