mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs: import bootstrapApplication from platform-browser in the CSP example
The `CSP_NONCE` example in the security guide imports `bootstrapApplication` from `@angular/core`, which does not export it, so copying the snippet fails with "has no exported member named 'bootstrapApplication'". It is exported from `@angular/platform-browser`, which is where every other example in the docs imports it from. Keep `CSP_NONCE` on `@angular/core` and import `bootstrapApplication` from `@angular/platform-browser`.
This commit is contained in:
@@ -155,7 +155,8 @@ You can set the nonce for Angular in one of the following ways:
|
||||
1. 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`.
|
||||
|
||||
```ts
|
||||
import {bootstrapApplication, CSP_NONCE} from '@angular/core';
|
||||
import {CSP_NONCE} from '@angular/core';
|
||||
import {bootstrapApplication} from '@angular/platform-browser';
|
||||
import {AppComponent} from './app/app.component';
|
||||
|
||||
bootstrapApplication(AppComponent, {
|
||||
|
||||
Reference in New Issue
Block a user