How to inherit css styles in child component from parent in Angular 5

前端 未结 3 814
天涯浪人
天涯浪人 2021-02-18 17:19

I have a parent component inside which I have a child component. The parent component have some css classes, where child component extends them. I tried to use :host as looking

3条回答
  •  一整个雨季
    2021-02-18 17:32

    Why make things complex?

    Ideal way to do would be to add refrence of parent css file in child component as well.

     @Component({
        selector: 'child-app',
        templateUrl: `./child.component.html`,
        styleUrls:['./parent/parent.component.css', './child.component.css']
    })
    export class ChildComponent { }
    

提交回复
热议问题