|
6 | 6 | * found in the LICENSE file at https://angular.io/license
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -import {Inject, Injectable, OnDestroy, Provider} from '@angular/core'; |
| 9 | +import {Inject, Injectable, OnDestroy, Provider, CSP_NONCE, Optional} from '@angular/core'; |
10 | 10 | import {DOCUMENT} from '@angular/common';
|
11 | 11 | import {coerceCssPixelValue} from '@angular/cdk/coercion';
|
12 | 12 | import {CdkTable, _CoalescedStyleScheduler, _COALESCED_STYLE_SCHEDULER} from '@angular/cdk/table';
|
@@ -144,6 +144,7 @@ export class CdkFlexTableResizeStrategy extends ResizeStrategy implements OnDest
|
144 | 144 | protected readonly styleScheduler: _CoalescedStyleScheduler,
|
145 | 145 | protected readonly table: CdkTable<unknown>,
|
146 | 146 | @Inject(DOCUMENT) document: any,
|
| 147 | + @Inject(CSP_NONCE) @Optional() private readonly _nonce?: string | null, |
147 | 148 | ) {
|
148 | 149 | super();
|
149 | 150 | this._document = document;
|
@@ -235,6 +236,11 @@ export class CdkFlexTableResizeStrategy extends ResizeStrategy implements OnDest
|
235 | 236 | private _getStyleSheet(): CSSStyleSheet {
|
236 | 237 | if (!this._styleElement) {
|
237 | 238 | this._styleElement = this._document.createElement('style');
|
| 239 | + |
| 240 | + if (this._nonce) { |
| 241 | + this._styleElement.nonce = this._nonce; |
| 242 | + } |
| 243 | + |
238 | 244 | this._styleElement.appendChild(this._document.createTextNode(''));
|
239 | 245 | this._document.head.appendChild(this._styleElement);
|
240 | 246 | }
|
|
0 commit comments