<div class="a">
<div class="b" *ngIf="shown">blabla</div>
<button (click)="onClick()">test</button>
</div>
@Component({
selector: 'my-component'
})
export class MyComponent {
@Input
shown: boolean;
onClick():void {
this.shown = false;
}
}
<my-component [shown]="property"></my-component>
@Component({
selector: 'my-component'
})
export class MyComponent {
@Input()
shown: boolean;
@Output()
shownChange = new EventEmitter<boolean>();
onClick():void {
this.shown = false;
this.shownChange.emit(this.shown);
}
}
<my-component [(shown)]="property"></my-component>