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)

相关推荐
new Vue()1 小时前
vue.js 原生js app端实现图片旋转、放大、缩小、拖拽
前端·javascript·vue.js
麒麟而非淇淋1 小时前
Vue 技术进阶 day2 数据监视的原理、其他内置指令、自定义指令、生命周期、组件化、VueComponent构造函数
前端·javascript·vue.js
战族狼魂1 小时前
基于TypeScript+React+AntDesign 的车辆车型管理页面
javascript·react.js·typescript
理想青年宁兴星1 小时前
vue中异步批量删除列表数据
前端·javascript·vue.js
勿语&1 小时前
侧边菜单的展开和折叠
javascript·vue.js
可别是个可爱鬼1 小时前
黑马智数Day3
前端·javascript·html
我很苦涩的2 小时前
解决json格式转换被特殊字符截断问题
javascript·json
余生H3 小时前
前端大模型入门:实战篇之Vue3+Antdv+transformers+本地模型实现增强搜索
前端·javascript·vue.js·深度学习·transformer·深度搜索·webml
wei_shuo4 小时前
上下位关系自动检测方法(论文复现)
前端·javascript·easyui