fix(upgrade): Prevent renaming of $inject property (#16706)
Use bracket notation to access $inject in downgradeInjectable to support property renaming. Since the return type is any, Closure compiler renames $inject.
This commit is contained in:
parent
b016984c04
commit
b83fe6f2a4
|
@ -53,7 +53,7 @@ import {INJECTOR_KEY} from './constants';
|
||||||
*/
|
*/
|
||||||
export function downgradeInjectable(token: any): Function {
|
export function downgradeInjectable(token: any): Function {
|
||||||
const factory = function(i: Injector) { return i.get(token); };
|
const factory = function(i: Injector) { return i.get(token); };
|
||||||
(factory as any).$inject = [INJECTOR_KEY];
|
(factory as any)['$inject'] = [INJECTOR_KEY];
|
||||||
|
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue