How to apply css class to a component element when it's created by router-outlet?

前端 未结 11 1446
南旧
南旧 2020-12-15 15:41

I have DOM that looks something like this:


    
    ...

         


        
11条回答
  •  庸人自扰
    2020-12-15 16:02

    Currently, Angular 6 recommends me to use @HostBindings and @HostListeners instead of the host property:

    export class ProjectComponent {
      @HostBinding('class') classes = 'classYouWantApplied';
    }
    

提交回复
热议问题