How to set default Chang…

less than 1 minute read

How to set default Change detection and view encapsulation in NX angular project?


Like in an angular workspace. I dont think it is different.

That is not an Nx specific configuration. Go into the app.component.ts file and change it there in the @Compobent decorator. That will cause it to cascade down to all child components as well

So, I just need to do that only for root component?

And what about schematics config? I’m not getting intellisence for angular schematics in angular.json. Is there any way to set defaults, which NX will take into account when I’ll run nx g commands

Change detection will cascade down yes (if set to onpush)

View encapsulation is compone t specific I believe

But I could be wrong

I assume that default view encapsulation may be set for entire app, because it already uses a default value of emulated, if I’m not mistaken

I’m not sure if there is a global setting for that. But if you plan on setting default to None for view enc I would probably not do that as it is advised against