Angular Content security policy

When serving your Angular application, the server should include a randomly-generated nonce in the HTTP header for each request. You must provide this nonce to Angular so that the framework can render <style> elements. You can set the nonce for Angular in one of two ways:

Way 1: Set the ngCspNonce attribute on the root application element as <app ngCspNonce="randomNonceGoesHere"></app>. Use this approach if you have access to server-side templating that can add the nonce both to the header and the index.html when constructing the response.

Way 2: Provide the nonce using the CSP_NONCE injection token. Use this approach if you have access to the nonce at runtime and you want to be able to cache the index.html.

![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/db71a512c7e242d5ad18cfab313e3578.png![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/a9adae240ab9439c86348a9b42f8ebec.png)

相关推荐
满分观测网友z10 分钟前
vue的<router-link>的to里面的query和params的区别
前端·javascript·vue.js
BillKu12 分钟前
Vue3 + TypeSrcipt 防抖、防止重复点击实例
前端·javascript·vue.js
Themberfue16 分钟前
Vue ⑥-路由
前端·javascript·vue.js
whatever who cares18 分钟前
React hook之useRef
前端·javascript·react.js
天涯学馆31 分钟前
工厂模式在 JavaScript 中的深度应用
前端·javascript·面试
crary,记忆36 分钟前
Angular中Webpack与ngx-build-plus 浅学
前端·webpack·angular·angular.js
newxtc40 分钟前
【JJ斗地主-注册安全分析报告】
开发语言·javascript·人工智能·安全
烛阴1 小时前
告别原生Cookie:js-cookie如何实现Cookie的优雅管理
前端·javascript
汪子熙2 小时前
走进 Fundamental NGX Platform:从 SAP 设计体系到高生产力组件层
前端·javascript·面试