I have a problem, that @input value in my angular app can not be updated
my code in child component
@Input() canAddMore?: boolean;
public setButtonVisible(){
this.canAddMore = false;
}
child component html
<button mat-mini-fab color="primary"
(click)="setButtonVisible()" *ngIf="canAddMore">
<mat-icon>add</mat-icon>
</button>
this function will be called, if a input field in form is added
and in parent component
<app-field
[canAddMore]="canAddMore"
>
</app-field>
in parent component there is also a button
public canAddMore: boolean;
public setButtonVisible(){
this.canAddMore = true;
}
and there is a button in parent component, which change the canAddMore = true.
the problem is, If I in child component setButtonVisible is called, and then call setButtonVisible in parent component,
the canAddMore will not be updated.
Any solutions?