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)

相关推荐
利刃大大3 小时前
【Vue】Vue2 和 Vue3 的区别
前端·javascript·vue.js
Lhuu(重开版3 小时前
JS:正则表达式和作用域
开发语言·javascript·正则表达式
yuguo.im5 小时前
我开源了一个 GrapesJS 插件
前端·javascript·开源·grapesjs
安且惜5 小时前
带弹窗的页面--以表格形式展示
前端·javascript·vue.js
摘星编程6 小时前
用React Native开发OpenHarmony应用:NFC读取标签数据
javascript·react native·react.js
AGMTI8 小时前
webSock动态注册消息回调函数功能实现
开发语言·前端·javascript
不吃香菜的猪8 小时前
使用@vue-office/pdf时,pdf展示不全
javascript·vue.js·pdf
wuhen_n8 小时前
TypeScript的对象类型:interface vs type
前端·javascript·typescript
css趣多多9 小时前
props,data函数,computed执行顺序
前端·javascript·vue.js
一个不称职的程序猿9 小时前
构建优雅的 Vue.js 表情包选择器:一个功能丰富且可定制的 Emoji Picker 组件
前端·javascript·vue.js