Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to edit ng-zorro component css in nz-modal?

This is my demo

Normally, I use

:host ::ng-deep nz-input-number {
  width: 100% !important;
}

:host ::ng-deep nz-date-picker span.ant-calendar-picker {
  width: 100% !important;
}

will can change CSS as I want.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

But it is not working with <nz-modal>.

enter image description here

>Solution :

Your modal HTML is part of your component. It means the view encapsulation is applied to it like it normally would.

So style it like you would style "normal" HTML.

https://stackblitz.com/edit/angular-9dvf1z-rzp7f3?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.component.scss

Note that for the second style, you have to use ::ng-deep because this is a span inside a library component.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading