shlomiassaf / ngx-modialog

Modal / Dialog for Angular
http://shlomiassaf.github.io/ngx-modialog
MIT License
686 stars 242 forks source link

Use ngStyle to avoid triggering CSP #425

Open thesam opened 6 years ago

thesam commented 6 years ago

Problem If a strict Content Security Policy (CSP) is enabled, it will block modals from being opened because the template in modal-container.component.ts contains an inline style.

Workaround: Allow "unsafe-inline" for styles in the CSP.

Proposed solution in this PR: Use [ngStyle] instead of style=. [ngStyle] is not blocked by the browser even with a strict CSP.