Open mribichich opened 6 years ago
If I put /* @ngInject */
just before the constructor it works.
class Foo {
@MyDecorator()
someProperty: string;
/* @ngInject */
constructor(private $element: ng.IAugmentedJQuery) {
}
}
The same is for Typescript decorated class with typescript configured for es2015 target:
input:
@LegacyComponent({
name: 'googleAutocompleteLegacy',
template: require('./google-autocomplete.legacy.component.jade'),
bindings: {
},
controllerAs: 'ctrl',
})
export class GoogleAutocompleteLegacyComponent {
constructor(
private $element: ng.IAugmentedJQuery,
) {
'ngInject';
}
}
Output:
let GoogleAutocompleteLegacyComponent = class GoogleAutocompleteLegacyComponent {
/* @ngInject */
constructor($element) {
'ngInject';
}
};
// <-- NO annotation for class here
GoogleAutocompleteLegacyComponent = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([Object(_libs_angularjs__WEBPACK_IMPORTED_MODULE_2__["LegacyComponent"])({
name: 'googleAutocompleteLegacy',
template: __webpack_require__(/*! ./google-autocomplete.legacy.component.jade */ "./legacy/modules/main/components/google-autocomplete/google-autocomplete.legacy.component.jade"),
bindings: {
},
controllerAs: 'ctrl'
})], GoogleAutocompleteLegacyComponent);
Seems problem take place when in generated code class assigned to a variable eq. let Foo = class Foo {}
If your class has a Decorator, then the plugin skips the transformation.
It works for everything else. Tested changing the
/* @ngInject */
comment to different places.I'm using
babel 7
This is the output from babel:
thanks