Skip to content

Commit

Permalink
fix(upgrade): Prevent renaming of $inject property (angular#16706)
Browse files Browse the repository at this point in the history
Use bracket notation to access $inject in downgradeInjectable to
support property renaming. Since the return type is any,
Closure compiler renames $inject.
  • Loading branch information
lozanol authored and Zhicheng Wang committed Aug 11, 2017
1 parent 63fae0d commit d9084cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/upgrade/src/common/downgrade_injectable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {INJECTOR_KEY} from './constants';
*/
export function downgradeInjectable(token: any): Function {
const factory = function(i: Injector) { return i.get(token); };
(factory as any).$inject = [INJECTOR_KEY];
(factory as any)['$inject'] = [INJECTOR_KEY];

return factory;
}

0 comments on commit d9084cc

Please sign in to comment.