Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this work with function based modules? #1

Closed
sethkrasnianski opened this issue Sep 18, 2015 · 3 comments
Closed

Does this work with function based modules? #1

sethkrasnianski opened this issue Sep 18, 2015 · 3 comments

Comments

@sethkrasnianski
Copy link

... as opposed to class based.

@Inject('service1', 'service2');

function localFunction() {
  return "did something";
}

export default function() {
  service1.something();
  service2.somethingElse();
  localFunction();
}

... or directive controllers?

@Inject('service1', 'service2');
function controller() {
  service1.something();
  service2.somethingElse();
}

export default function() {
  return {
    restrict: 'E',
    template: templates['myTemplate'],
    controller: controller
  };
}
@mchmielarski
Copy link
Owner

Hi,

No, but you can use classes for controller, directives.
here is small example: https://github.com/mchmielarski/babel-plugin-ng-annotate/tree/master/example/src

@leandroz
Copy link

I think the problem is with run and config where they need a function and not a class.

@chocolateboy
Copy link

chocolateboy commented May 12, 2017

No, but you can use classes for controller, directives.

$ babel --presets es2015 ./ExampleDirective.js

SyntaxError: ./ExampleDirective.js: Unexpected token (3:16)
  1 | class ExampleDirective {
  2 | 
> 3 |   restrict      = 'E';
    |                 ^
  4 |   controller    = 'ExampleController';
  5 |   controllerAs  = '$exCtrl';
  6 |   template      = `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants