Skip to content

$inject is not added on exported class when transforming to ES5 #35

@sarod

Description

@sarod

When using the following code angularjs-annotate fails to annotate the class if the class is transpiled to ES5

/*@ngInject*/
export class Broken {
  	constructor($q) {
    
    }  
}box chec

The problem can be reproduced on the demo page https://schmod.github.io/babel-plugin-angularjs-annotate/ with the transform checkbox checked

Note that this works fine if the class is not exported.

I found several alternative placement of the @ngInject that work.

export /*@ngInject*/ class Ok {
  	constructor($q) {
    
    }  
}

export class Ok2 {
  /*@ngInject*/	
  constructor($q) {
    
    }  
}

It 1 also works if I use an alias for export

/* @ngInject */
class MyControllerInternal {
  constructor($q) {}
}

export const MyController = MyControllerInternal;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions