I have a directive in angular 11 with the following inputs :
@Directive({
selector: "[appHasToken]",
})
export class HasTokenDirective implements OnInit, OnDestroy {
@Input("appHasToken") fallback: TemplateRef<any>;
@Input("showWarning") showWarning = false;
//...
}
I call it in my code like this :
<ng-container *appHasToken="noToken">
Now in a single place, I want the showWarning to true, so I did
<ng-container *appHasToken="noToken;" [showWarning]="true">
but I am prompted with
Can't bind to 'showWarning' since it isn't a known property of 'ng-container'
now, I know I can rename the input with a different name than the directive and do
<ng-container appHasToken [templateRef]="noToken" [showWarning]="true">
but what about keeping the same stuff I was doing, is there a fix ?