graphql-demo icon indicating copy to clipboard operation
graphql-demo copied to clipboard

Angular1.5 demo with CoffeeScript

Open NaveenKarippai opened this issue 8 years ago • 10 comments

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

NaveenKarippai avatar Jan 27 '17 09:01 NaveenKarippai

@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.

kamilkisiela avatar Jan 27 '17 12:01 kamilkisiela

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

robzhu avatar Jan 27 '17 16:01 robzhu

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

Urigo avatar Jan 30 '17 05:01 Urigo

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

Due to package dependency issue, I was bound to install [email protected] , [email protected] on CoffeeScript, AngularJS 1.5.0

@Urigo Thanks for the heads up!

NaveenKarippai avatar Jan 30 '17 09:01 NaveenKarippai

@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....)

Urigo avatar Jan 31 '17 07:01 Urigo

@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).

NaveenKarippai avatar Jan 31 '17 11:01 NaveenKarippai

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

Urigo avatar Feb 01 '17 01:02 Urigo

@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.

NaveenKarippai avatar Feb 01 '17 10:02 NaveenKarippai

@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?

kamilkisiela avatar Feb 03 '17 09:02 kamilkisiela

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

idanhen avatar Nov 13 '17 12:11 idanhen