-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluate using host directives in Angular 15 #1032
Comments
For
We could split off common parts of the interface into a separate directive (that was then brought along via @Directive({
standalone: true
})
export class NimbleButtonCommonDirective {
public get appearance(): ButtonAppearance {
return this.elementRef.nativeElement.appearance;
}
@Input() public set appearance(value: ButtonAppearance) {
this.renderer.setProperty(this.elementRef.nativeElement, 'appearance', value);
}
...
}
@Directive({
selector: 'nimble-button',
hostDirectives: [{
directive: NimbleButtonCommonDirective,
inputs: ['appearance', ...]
}]
}
export class NimbleButtonDirective {
private readonly buttonCommon: NimbleButtonCommonDirective = inject(NimbleButtonCommonDirective, { self: true });
public get appearance(): ButtonAppearance {
return this.buttonCommon.appearance;
}
public set appearance(value: ButtonAppearance) {
this.buttonCommon.appearance = value;
}
...
} I did not find any other potential uses for host directives in nimble-angular. |
@rajsite I remember you pushing back some about this being a closed issue, but I don't remember details. Do you still have reservations, or specific things you think merit further investigation? |
Think Molly had split the discussion and this one is fine to close |
🧹 Tech Debt
Once we upgrade to Angular 15, we should evaluate using HostDirectives as a way to simplify our Angular code. Some ideas/questions are:
RouterLinkWithHref
The text was updated successfully, but these errors were encountered: