fix(ivy): @Inject should not overwrite an existing ngInjectableDef (#27278)
There is no test in this diff because I've made a failing test pass. PR Close #27278
This commit is contained in:
parent
d35d164ece
commit
1cca27d823
|
@ -27,6 +27,10 @@ export function compileInjectable(type: Type<any>, srcMeta?: Injectable): void {
|
||||||
const meta: Injectable = srcMeta || {providedIn: null};
|
const meta: Injectable = srcMeta || {providedIn: null};
|
||||||
|
|
||||||
let def: any = null;
|
let def: any = null;
|
||||||
|
|
||||||
|
// if NG_INJECTABLE_DEF is already defined on this class then don't overwrite it
|
||||||
|
if (type.hasOwnProperty(NG_INJECTABLE_DEF)) return;
|
||||||
|
|
||||||
Object.defineProperty(type, NG_INJECTABLE_DEF, {
|
Object.defineProperty(type, NG_INJECTABLE_DEF, {
|
||||||
get: () => {
|
get: () => {
|
||||||
if (def === null) {
|
if (def === null) {
|
||||||
|
|
Loading…
Reference in New Issue