I’ve a component modal which has a darkUnderneath property. I’m trying to bind it using [darkUnderneath]="true" in my parent component’s template and am getting:
Can’t bind to ‘darkUnderneath’ since it isn’t a known property of ‘modal’.
Do I need to use the @Output decorator? I tried defining darkUnderneath with and without the @Output decorator from @angular/core.
<modal [darkUnderneath]="blah"></modal>
export class ModalComponent implements OnInit {
@Output()
darkUnderneath: boolean = false;
// ...
}
>Solution :
You’re looking for the @Input decorator.
export class ModalComponent implements OnInit {
@Input()
darkUnderneath: boolean = false;
// ...
}