|
6 | 6 | * found in the LICENSE file at https://angular.io/license
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -import {Directive, ElementRef, Inject, OnDestroy, OnInit, Optional} from '@angular/core'; |
| 9 | +import {CSP_NONCE, Directive, ElementRef, Inject, OnDestroy, OnInit, Optional} from '@angular/core'; |
10 | 10 | import {DOCUMENT} from '@angular/common';
|
11 | 11 | import {Directionality} from '@angular/cdk/bidi';
|
12 | 12 | import {_getShadowRoot} from '@angular/cdk/platform';
|
@@ -52,6 +52,7 @@ export class CdkTableScrollContainer implements StickyPositioningListener, OnDes
|
52 | 52 | private readonly _elementRef: ElementRef<HTMLElement>,
|
53 | 53 | @Inject(DOCUMENT) private readonly _document: Document,
|
54 | 54 | @Optional() private readonly _directionality?: Directionality,
|
| 55 | + @Optional() @Inject(CSP_NONCE) private readonly _nonce?: string | null, |
55 | 56 | ) {
|
56 | 57 | this._uniqueClassName = `cdk-table-scroll-container-${++nextId}`;
|
57 | 58 | _elementRef.nativeElement.classList.add(this._uniqueClassName);
|
@@ -114,6 +115,11 @@ export class CdkTableScrollContainer implements StickyPositioningListener, OnDes
|
114 | 115 | private _getStyleSheet(): CSSStyleSheet {
|
115 | 116 | if (!this._styleElement) {
|
116 | 117 | this._styleElement = this._document.createElement('style');
|
| 118 | + |
| 119 | + if (this._nonce) { |
| 120 | + this._styleElement.nonce = this._nonce; |
| 121 | + } |
| 122 | + |
117 | 123 | this._styleRoot.appendChild(this._styleElement);
|
118 | 124 | }
|
119 | 125 |
|
|
0 commit comments