I'm trying to set ngIf on the host element using @HostBinding decorator.
class ListItem {
@HostBinding('ngIf') active: boolean = false;
}
And I'm getting the error: Can't bind to 'ngIf' since it isn't a known property of 'list-item'.
However I see an answer here which seems to be suggesting this usage.
ngIf
is a directive and directives can't be added dynamically. They are only applied if markup added statically to a components template matches the selector.
@HostBinding()
only supports class.
, attr.
, and style.
bindings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With