null_injector.ts (angular-11.0.1) | : | null_injector.ts (angular-11.0.2) | ||
---|---|---|---|---|
/** | /** | |||
* @license | * @license | |||
* Copyright Google LLC All Rights Reserved. | * Copyright Google LLC All Rights Reserved. | |||
* | * | |||
* Use of this source code is governed by an MIT-style license that can be | * 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 | * found in the LICENSE file at https://angular.io/license | |||
*/ | */ | |||
import {stringify} from '../util/stringify'; | import {stringify} from '../util/stringify'; | |||
import {Injector} from '.'; | import {Injector} from './injector'; | |||
import {THROW_IF_NOT_FOUND} from './injector_compatibility'; | import {THROW_IF_NOT_FOUND} from './injector_compatibility'; | |||
export class NullInjector implements Injector { | export class NullInjector implements Injector { | |||
get(token: any, notFoundValue: any = THROW_IF_NOT_FOUND): any { | get(token: any, notFoundValue: any = THROW_IF_NOT_FOUND): any { | |||
if (notFoundValue === THROW_IF_NOT_FOUND) { | if (notFoundValue === THROW_IF_NOT_FOUND) { | |||
const error = new Error(`NullInjectorError: No provider for ${stringify(to ken)}!`); | const error = new Error(`NullInjectorError: No provider for ${stringify(to ken)}!`); | |||
error.name = 'NullInjectorError'; | error.name = 'NullInjectorError'; | |||
throw error; | throw error; | |||
} | } | |||
return notFoundValue; | return notFoundValue; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |