ngParty / ng-metadata

Angular 2 decorators and utils for Angular 1.x

Home Page:https://hotell.gitbooks.io/ng-metadata/content/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for ES6/2015?

aelbore opened this issue · comments

commented

Does this support for ES6 code?

I'm sorry what do you mean by support for ES6 code? It's an Angular 2 back port to ng1 powered by Typescript and Es2015.

Maybe next time read the docs before raising an issue?

Thanks

commented

apologise for confusion, what i mean is i use js/es6 code, then when i use bundle for jspm i encounter error. im not sure if its for the decorators.

Probably you haven't configured typescript to emit decorators.
Check the compiler options https://www.typescriptlang.org/docs/handbook/compiler-options.html for emitDecoratorMetadata and experimentalDecorators.
And than you also need reflect-metadata. Everything is described in detail in the introduction to ng-metadata https://hotell.gitbooks.io/ng-metadata/content/ in sections Dependencies and Configure your project

The "why" section of the readme references why TypeScript is needed. There could be other reasons.

[ng-forward] doesn't provides angular 2 like DI via constructor parameters because babel just won't support parameter decorators

@aelbore any updates on this?

I've actually been using ng-metadata just fine with ES6/Babel, you just need Babel configured to use babel-preset-angular2. It adds support for class and parameter decorators, which is really all that's necessary.

commented

hey to all, we can close this. thanks to all suggestion. i created a starter repo for ng-metadata for es6/es2015 maybe or anyone can review my work :)

https://github.com/aelbore/ng-es6-starter

@rockmacaca cool stuff mister! maybe you can share how it looks like with rest of community? We can add it to docs also(recipes)

@Hotell Unfortunately no, not with the stuff I'm working on : /
(we're actually trying to transition over to TypeScript currently!)

It shouldn't be too difficult to try porting some of the playground when I have the time. It would probably end up being a Webpack 2 setup, since that's what I'm working with right now. I'll link it in slack if I ever get around to it.

For anyone looking for a babel 6, webpack 2 setup

https://github.com/jbadeau/Angular1-scaffold