robzhu / graphql-demo

Live-coding GraphQL demo
BSD 3-Clause "New" or "Revised" License
78 stars 19 forks source link

Angular1.5 demo with CoffeeScript #3

Open NaveenKarippai opened 7 years ago

NaveenKarippai commented 7 years ago

Can someone throw a hint on how to get GraphQL (apollo-client) work with CoffeeScript-AngularJS 1.5 stack ? The CoffeeScript we run does not support import keyword unlike in Babel compiler (as shown in demo).

The built-in module dependency of Angular1.5.0 does not seem to do the trick when calling - angular.module('myApp', ['apollo-client']).

Any help would be highly appreciated!

@robzhu @kamilkisiela

kamilkisiela commented 7 years ago

@NaveenKarippai You can use angular1-apollo. I created it quite some time ago and the latest version does not work with the latest apollo-client. It will after we release that PR apollostack/angular1-apollo#12

I'm not that familiar with CoffeeScript but there should be a support for CommonJS so require('angular1-apollo') should work.

robzhu commented 7 years ago

paging @urigo who has a lot of experience with Angular and might be able to help.

Urigo commented 7 years ago

@NaveenKarippai tomorrow we will release the new version @kamilkisiela is talking about

NaveenKarippai commented 7 years ago

@kamilkisiela hm, require keyword doesn't seem to be supported on coffee.

Due to package dependency issue, I was bound to install apollo-client@0.6.0 , angular1-apollo@0.1.0 on CoffeeScript, AngularJS 1.5.0

@Urigo Thanks for the heads up!

Urigo commented 7 years ago

@NaveenKarippai I've released 0.2.0, please let me know if that works for you (I don't know about CoffeeScript though, haven't used it in about two years....)

NaveenKarippai commented 7 years ago

@Urigo

hey, Thanks for the update! I managed to install latest version of packages. Would it be possible for you to throw a code snippet on how to use angular1-apollo , apollo-client packages with VanillaJS/ AngularJS 1.5.0 stack?

I am not sure how to workaround import keyword support in AngularJS/ CoffeeScript/ VanillaJS stack. I see that the demo on this repo use Babel (supports import keyword).

Urigo commented 7 years ago

@NaveenKarippai can you try to create something that fails and I'll go in and try to fix it?

NaveenKarippai commented 7 years ago

@Urigo

Any chance to see a demo repo written on AngularJS 1.5 / ES5 (without babel) please ?

This might help us to find a workaround on AngularJS/Coffee stack.

Maybe the tools like browserify / Webpack might also help (didn't try {yet}) with this issue as we don't have a system that supports CommonJS/ES2015 modules.

kamilkisiela commented 7 years ago

@NaveenKarippai Load angular1-apollo as you load angular. Then include angular-apollo in modules.

angular.module('app', [
  'angular-apollo'
])

So how do you use angular?

idanhen commented 7 years ago

this is important to notice, when you install npm install apollo-client@">=1.0.0 <2.0.0"

this solves alot of my problems. using angular1