Home > Enterprise >  Angular 12 ::ng-deep (deprecated)? Only option that's working?
Angular 12 ::ng-deep (deprecated)? Only option that's working?

Time:09-30

I am trying the change the text in ngx-charts and this works:

::ng-deep .ngx-charts { 
    text{
        fill: #ff0000; 
    }
}

The only issue is that ::ng-deep is deprecated?

:host will not work

So what do I use instead that works?

CodePudding user response:

You'll likely have to apply this style at a global level in styles.[s]css or a file that gets imported in styles.[s]css/bundled when bundling your other global css.

(I usually path it directly from my component, ex:)

app-my-component-that-uses-this-chart {
  .ngx-charts {
    text {
       fill: #ff0000;
    }
  }
}

But you can also apply a class instead of a component name to make it more reusable

  • Related