|
1 |
| -/** |
2 |
| - * @license |
3 |
| - * Copyright Google Inc. All Rights Reserved. |
4 |
| - * |
5 |
| - * Use of this source code is governed by an MIT-style license that can be |
6 |
| - * found in the LICENSE file at https://angular.io/license |
7 |
| - */ |
8 |
| - |
9 |
| -import {Injector} from '@angular/core'; |
10 |
| - |
11 |
| -/** |
12 |
| - * Custom injector to be used when providing custom |
13 |
| - * injection tokens to components inside a portal. |
14 |
| - * @docs-private |
15 |
| - */ |
16 |
| -export class PortalInjector implements Injector { |
17 |
| - constructor( |
18 |
| - private _parentInjector: Injector, |
19 |
| - private _customTokens: WeakMap<any, any>) { } |
20 |
| - |
21 |
| - get(token: any, notFoundValue?: any): any { |
22 |
| - const value = this._customTokens.get(token); |
23 |
| - |
24 |
| - if (typeof value !== 'undefined') { |
25 |
| - return value; |
26 |
| - } |
27 |
| - |
28 |
| - return this._parentInjector.get<any>(token, notFoundValue); |
29 |
| - } |
30 |
| -} |
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright Google Inc. All Rights Reserved. |
| 4 | + * |
| 5 | + * Use of this source code is governed by an MIT-style license that can be |
| 6 | + * found in the LICENSE file at https://angular.io/license |
| 7 | + */ |
| 8 | + |
| 9 | +import {Injector} from '@angular/core'; |
| 10 | + |
| 11 | +/** |
| 12 | + * Custom injector to be used when providing custom |
| 13 | + * injection tokens to components inside a portal. |
| 14 | + * @docs-private |
| 15 | + */ |
| 16 | +export class PortalInjector implements Injector { |
| 17 | + constructor( |
| 18 | + private _parentInjector: Injector, |
| 19 | + private _customTokens: WeakMap<any, any>) { } |
| 20 | + |
| 21 | + get(token: any, notFoundValue?: any): any { |
| 22 | + const value = this._customTokens.get(token); |
| 23 | + |
| 24 | + if (typeof value !== 'undefined') { |
| 25 | + return value; |
| 26 | + } |
| 27 | + |
| 28 | + return this._parentInjector.get<any>(token, notFoundValue); |
| 29 | + } |
| 30 | +} |
0 commit comments