I have an Angular 2/4 application where a user can set his own style. This means he can set a color which is then used for links, buttons etc. This is done by directives e.g. like that:
@Directive({
selector: '.btn-primary'
})
export class ColorDirective {
@HostBinding('style.color') color: string;
constructor(private store: Store<AppState>) {
this.store.select('config', 'config').subscribe((config: Config) => {
this.color = config.color;
});
}
}
Now we'd also like to style the checkboxes and radio buttons like that. They are currently styled using :before
and :checked
selectors. Angular cannot select on pseudoelements. Thus the approach above is not possible. Any ideas how to achieve this outcome?