Reputation: 1537
Is it possible to set the HostBinding with an Input property. If not what is your approximate solution?
For Ex:
Directive:
@Input('customToggle') target;
private toggle = false;
@HostBinding(target)
get getToggle() {
return this.toggle;
}
View:
<li class="dropdown" [customToggle]="class.open">
Note how HostBinding has target passed as an argument, how can this be accomplished?
Upvotes: 2
Views: 736
Reputation: 1783
You can do it this way :
@HostBinding(target) toggle: boolean = false;
@Input('customToggle') set target(toggle: boolean) {
this.toggle = toggle;
}
Upvotes: 1