-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {Injector} from '@angular/core'; | ||
|
||
/** | ||
* Custom injector to be used when providing custom | ||
* injection tokens to components inside a portal. | ||
* @docs-private | ||
*/ | ||
export class PortalInjector implements Injector { | ||
constructor( | ||
private _parentInjector: Injector, | ||
private _customTokens: WeakMap<any, any>) { } | ||
|
||
get(token: any, notFoundValue?: any): any { | ||
const value = this._customTokens.get(token); | ||
|
||
if (typeof value !== 'undefined') { | ||
return value; | ||
} | ||
|
||
return this._parentInjector.get<any>(token, notFoundValue); | ||
} | ||
} | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {Injector} from '@angular/core'; | ||
|
||
/** | ||
* Custom injector to be used when providing custom | ||
* injection tokens to components inside a portal. | ||
* @docs-private | ||
*/ | ||
export class PortalInjector implements Injector { | ||
constructor( | ||
private _parentInjector: Injector, | ||
private _customTokens: WeakMap<any, any>) { } | ||
|
||
get(token: any, notFoundValue?: any): any { | ||
const value = this._customTokens.get(token); | ||
|
||
if (typeof value !== 'undefined') { | ||
return value; | ||
} | ||
|
||
return this._parentInjector.get<any>(token, notFoundValue); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters