pbastowski / angular2-now

Angular 2 @Component syntax for Angular 1 apps
MIT License
145 stars 15 forks source link

usage with jspm and typescript #1

Closed maku closed 9 years ago

maku commented 9 years ago

I am curious how to use angular2-now with typescript and jspm. Any ideas?

pbastowski commented 9 years ago

@maku, at the moment the angular2-now library implements decorators/annotations according to the Babel spec. I had a quick look at the typescript playground and it would appear that TypeScript implements annotations in the same way that Babel does. But, there are type checking and scoping considerations to consider.

Perhaps you could have a look at this fork by another user: https://github.com/nalbion/angular2-now

I don't know if it works, just noticed that it exists :)

Right now I don't have spare time to port angular2-now to TypeScript. If you'd like to help with that then I'm happy to accept the help.

maku commented 9 years ago

Thanks for the hint. A quick test with the fork (https://github.com/nalbion/angular2-now) worked for me...

ghost commented 9 years ago

@maku Did you get this working w/o needing the fork?

I created the typescript definitions : https://github.com/pbastowski/angular2-now/issues/16

maku commented 9 years ago

@robertbaker I wrote something myself

ghost commented 9 years ago

@maku Can you give me some hints? I'm using the master branch and it isn't working with JSPM/SystemJS

maku commented 9 years ago

@robertbaker sorry I don't use angular2-now (wrote some decorators myself)

pbastowski commented 9 years ago

I am working on it and have a working beta version, but won't be able to release it until after I come back from my vacation in August. Sorry.

ghost commented 9 years ago

@pbastowski Can you share what you have with me?

I'm trying to implement this in an app currently under development and spent a lot of time refactoring the project to use it. If I can't use it, then I just wasted a weekend, and will basically have to re-do everything once it's released since it's under active development.

pbastowski commented 9 years ago

Sorry, it's on my laptop at home and I'm on vacation. I will be back around 13 August and will try to release it asap then.

pbastowski commented 9 years ago

However, you could for now just extract the core of my code, the part within the function wrapper, and then add "export" before each of my decorator functions. Then, jspm will see each exported function and make it visible when you import from the library.

Or, as suggested earlier, grab all the functions you need from the exported window.angular2now object.