How I can use graphql with angular 1.5? - angularjs

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.

You can use angular1-apollo package.
http://github.com/apollostack/angular1-apollo

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

Here is a live example. Basically the biggest part is how to set up the client in the config, from there you can just use it like any other service.
https://codesandbox.io/s/l4r87nqj5z
Edit: this actually uses the library in Kamil's answer.

Related

routing between angular js and symfony 2

How to make routing of a symfony application in angular js ,I have a symfony application with its templates and I can make the routing of the templates of this application by angular js
thanks you
I am not quite sure what you mean to ask, but probably you are looking for a way to access your Symfony routes in Angular.
In that case, take a look at the
FOSJsRoutingBundle
It provides a javascript object that you can use to generate urls much like the path() function in Twig. For example:
Routing.generate('your_route', {'foo': 'bar'})
You only need a few steps in order use use.

Custom login screen with Auth0 and AngularJS

Angular 2 has a custom login: https://auth0.com/docs/quickstart/spa/angular2/02-custom-login
But I can't find any for AngularJS, https://auth0.com/docs/quickstart/spa/angularjs
Is it not possible to have a custom login with AngularJS? Or do I need to manually use an API on the back-end?
It's possible to achieve the same functionality either by using Angular 1.X or Angular2. In this case, it's just a mismatch in the available sample code.
You would do this using the same Auth0 library, Auth0.js, that is being used in the Angular2 sample to achieve the custom login, so you can use that code as a baseline of what you need to do and adapt it from Angular2 to Angular 1.X or you can also check the documentation of the Auth0.js library itself; the section about single page apps would likely be the most useful.

how to access process.env.endPointAPI in factories

how to access this variable "process.env.endPointAPI" in yeoman
in the factories Services ?
I want to call the API from different server?
To complement my comment to the question and to provide a more detailed answer:
It is necessary more info regarding your code. I guess you are using a yeoman generator with nodejs server side, maybe with expressjs. If that is the case then you need to pass process.env.endPointAPI via express with the help of your templating engine or change your grunt/gulp tasks to include it in a custom angular factory (for example) when you serve/build your app.
This article describes some of these situations step-by-step.
If the options in the article above don't work for you for some reason, and you are using grunt, maybe you can give grunt-ng-constant a try. Basically, it will generate you a custom constant-value utility for Angular. Once injected in your app module you can access those values from your controllers for example.

Symfony 1.4 and angularJS

As mentionned in the title I want to use angularJS with Symfony1.4.
Is that possible? and How to integrate this framework with Symfony1.4?
Of course you can.
If you are familiar with AngularJS you should now that the important things to be considered is to import correctly the script files, and to declare correctly your app and controller.
The same has to be done in Symfony, importing scripts and declaring Angular app.
I'm actually using it, and it works great.
you dont need integrate Angular with Symfony because Angular is a Javascript framework (client) and Symfony its a PHP Framework (Server). simply you can make a API with symfony a simple static entry point for start the angular application and use the API from the Angular App

Does Breeze require jQuery when used with AngularJS?

I am confused about using Breeze. I have looked through the documentation but did not see an answer for this.
When I use Breeze with ASP MVC4 and AngularJS, is it necessary for me to have the jQuery script loaded also?
[Updated Answer 10/15/2013]
(Fixed the date)
As of Breeze 1.4.4, we now support an angular ajax adapter that uses $http. See the 1.4.4 release notes for more details. So JQuery is no longer a requirement.
Breeze uses JQuery to provide its default ajax support, independent of Angular. This is provided by the breeze.jquery.ajax adapter and is pluggable. This means that you can either use JQuery or provide an alternative ajax adapter. Breeze's Angular support will work with either.
Out of the box, though, JQuery is necessary.
We will very likely provide an alternative ajax adapter that uses Angular's ajax implementation at some point in the next few months. Note that no code will need to change when this occurs, other than configuring breeze to use an alternate adapter.
As described in Customizing AJAX, you can configure Breeze to use Angular's $http service instead of jQuery like this:
breeze.config.initializeAdapterInstance('ajax', 'angular').setHttp($http);
No. Just do this:
breeze.config.initializeAdapterInstance("ajax", "angular");

Resources