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)

相关推荐
bai27314 小时前
同一条 q=a+b:URLSearchParams 读成空格、decodeURIComponent 读成加号,11 条查询串打进裸 socket 的实测
javascript·后端
tryCbest15 小时前
Python 爬虫扩展篇(一):APP 抓包与 JS 逆向入门——从看见流量到读懂签名
javascript·爬虫·python
狮子座的男孩15 小时前
javascript 基础 es6:4、Symbol,Symbol创建对象属性,Symbol内置属性,迭代器,迭代器自定义遍历对象
javascript·经验分享·迭代器·es6·symbol·symbol创建对象属性·symbol内置属性
狮子座的男孩15 小时前
javascript 基础 es6:3、参数默认值,reset参数,spread扩展运算符,扩展运算符应用
前端·javascript·经验分享·es6·参数默认值·reset参数·spread扩展运算符
map_3d_vis15 小时前
JSAPI 4.0 的命名空间:BMap 和 BMapGL 为什么都能用
前端·javascript·typescript·百度地图
code2cat16 小时前
Vue项目实战之任务保存:编辑失败后,怎样保留输入再重试
前端·javascript·vue.js
1-1=016 小时前
Vue TodoList
前端·javascript·vue.js
多加点辣也没关系1 天前
JavaScript|第41章:性能优化实战
开发语言·javascript·性能优化
feixing_fx1 天前
解构与展开:可读性和性能的取舍
开发语言·前端·javascript·前端框架
小小小小宇1 天前
Chrome 扩展如何操作浏览器:chrome.debugger 与 CDP 的区别
javascript