Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can use graphql with angular 1.5?

I have standart factories in my angular app for rest api. I need to configure my angular app for api with GraphQl. How i can do this? I now about angular2-apollo but I have angular 1.5.

like image 830
coder fire Avatar asked Aug 16 '16 09:08

coder fire


People also ask

Can you use GraphQL with angular?

Apollo Angular is the ultra-flexible, community driven GraphQL client for Angular, JavaScript, and native platforms. It is designed from the ground up to make it easy to build UI components that fetch data with GraphQL.

Can you use GraphQL without Apollo?

Yes. We can use GraphQL with React without using Apollo Client. We can use fetch or axios and can make things work the same. Below example demonstrates the usage of fetch to query a GraphQL endpoint.

What is Apollo client in angular?

Apollo Client is a comprehensive state management library for JavaScript that enables you to manage both local and remote data with GraphQL. Use it to fetch, cache, and modify application data, all while automatically updating your UI.


2 Answers

You can use angular1-apollo package.

http://github.com/apollostack/angular1-apollo

like image 186
Kamil Kisiela Avatar answered Oct 17 '22 21:10

Kamil Kisiela


Yes you can use Apollo-Client and just wrap the functions with $q.

Here is an example (Look at the Angular1App folder): https://github.com/robzhu/graphql-demo

like image 22
Urigo Avatar answered Oct 17 '22 22:10

Urigo