I have this component and I need to add dynamic class at host component dynamically
@Component({
selector: 'test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class TestComponent implements OnInit {
@HostBinding('className') componentClass: string;
@Input() name: string;
constructor() {}
ngOnInit(): void {
this.componentClass = this.name ? `test-icons test-icons-${this.name}` : '';
}
}
this works but if I try to add one class on my component this is override by the classes added during control.
Example, if I wtite:
<test-component class="custom-class-i-added" [name]="'icon']></test-component>
class "custom-class-i-added" disappear...i want to create a system that add dynamic classes at the existing ones....Is there a way?