I have Child component:
fixedheader.html
<button type="button" [hidden]="hideComponent()">
Close
</button>
I want to hide it based on the return value from the function in the parent component.
fixedheader.ts
@Output() ComponentHidden: EventEmitter<any> = new EventEmitter();
hideComponent() {
this.ComponentHidden.emit();
}
parent.html
<app-fixedheader [currentPage]="'SaleEdit'" [menuTitle]="viewTitle" [validForSave]="validForSave" (ComponentHidden)="ComponentHidden('salesEditComponentRef2')">
</app-fixedheader>
parent.ts
ComponentHidden(id: string): boolean {
let component = this.componentsReferences.find(i => i.viewId == id);
return (component === undefined ? true : false);
}
So here how I need to get the return value from the parent into child and it should be hidden based on that.
Did I miss something here ?