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)

相关推荐
姑苏洛言10 分钟前
待办事项小程序开发
前端·javascript
Warren982 小时前
公司项目用户密码加密方案推荐(兼顾安全、可靠与通用性)
java·开发语言·前端·javascript·vue.js·python·安全
1024小神4 小时前
vue3 + vite项目,如果在build的时候对代码加密混淆
前端·javascript
轻语呢喃4 小时前
useRef :掌握 DOM 访问与持久化状态的利器
前端·javascript·react.js
橙某人5 小时前
🖼️照片展示新境界!等高不等宽自适应布局完整教程⚡⚡⚡
前端·javascript·css
尝尝你的优乐美5 小时前
man!在console中随心所欲的打印图片和字符画
前端·javascript·vue.js
掘金016 小时前
Vue3 项目中实现特定页面离开提示保存功能方案
javascript·vue.js
余_弦7 小时前
区块链钱包开发(十九)—— 构建账户控制器(AccountsController)
javascript·区块链·以太坊
前端Hardy7 小时前
HTML&CSS:有趣的小铃铛
javascript·css·html
起这个名字7 小时前
Vue2/3 v-model 使用区别详解,不了解的来看看
前端·javascript·vue.js