Using a custom directive how would you add/remove a class on the host element based on a specific conditions?
Example:
@Directive({
selector: '[customDirective]'
})
export class CustomDirective {
constructor(service: SomService) {
// code to add class
if (service.someCondition()) {
// code to remove class
}
}
}
See Question&Answers more detail:os