babel-plugin-annotate-ng
v0.3.0
Published
babel plugin annotate angular v1.
Downloads
5
Readme
babel-plugin-annotate-ng
Annotate angular v1 DI dependency.
Usage
Add comment above export:
/* @ngInject */
export default class MonitorController {
constructor($q, $sce, $animate) {
this.$q = $q;
this.$sce = $sce;
this.$animate = $animate;
}
ngOnInit() {
}
ngAfterViewInit() {}
ngOnDestroy() {}
}
/* @ngInject */
export function ShowcaseController($q, $sce, $animate) {
this.$q = $q;
this.$sce = $sce;
this.$animate = $animate;
// lifecycle method
this.ngOnInit = ngOnInit;
this.ngAfterViewInit = ngAfterViewInit;
this.ngOnDestroy = ngOnDestroy;
// function declare
function ngOnInit() {}
function ngAfterViewInit() {}
function ngOnDestroy() {}
}
Add comment inline before declaration:
export default /* @ngInject */ class MonitorInlineController {
constructor($q, $sce, $animate) {
this.$q = $q;
this.$sce = $sce;
this.$animate = $animate;
}
ngOnInit() {
}
ngAfterViewInit() {}
ngOnDestroy() {}
}
export /* @ngInject */ function ShowcaseInlineController($q, $sce, $animate) {
this.$q = $q;
this.$sce = $sce;
this.$animate = $animate;
// lifecycle method
this.ngOnInit = ngOnInit;
this.ngAfterViewInit = ngAfterViewInit;
this.ngOnDestroy = ngOnDestroy;
// function declare
function ngOnInit() {}
function ngAfterViewInit() {}
function ngOnDestroy() {}
}
Add babel plugin:
{
"plugin": ["annotate-ng"]
}
License
MIT