fsi
fsi

Reputation: 1367

resolveComponentFactory overriding css

In my Component A, I have created another component using resolveComponentFactory and createComponent() and I wanted to use the css styleUrls of my Component A to change some parts of component created. There are any way to do this?

I tried to use !important and had no effects/changes on in <ng-template></ng-template>, which contains the html of component created.

Upvotes: 0

Views: 142

Answers (1)

penleychan
penleychan

Reputation: 5470

You need to use ng-deep for example:

::ng-deep .myCustomCss {
    background: red;
}

See: https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep

Please note that it does say deprecated however there was a github post by an angular team member saying that this is the way to go until a long term solution is found.

Upvotes: 1

Related Questions