slam4:richclient:angularjs:project:openbeerdatabase:rest

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
slam4:richclient:angularjs:project:openbeerdatabase:rest [2015/03/10 00:08] – [1- Connexion] jcheronslam4:richclient:angularjs:project:openbeerdatabase:rest [2019/08/31 14:21] (Version actuelle) – modification externe 127.0.0.1
Ligne 19: Ligne 19:
 {connected: false}</sxh> | {connected: false}</sxh> |
  
 +<html><div class="note"><div id="myContainer">
 +<h3>Exemple de connection avec Angular :</h3>
 +</html>
 +<sxh javascript;title:Connexion>
 +
 +data.posted={"mail":"admin@local.fr","password":"0000"};
 +this.connect(data,function(d){console.log("Connexion réussie, token : "+d.token)});
 +
 +this.connect=function(response,callBack){
 + var request = $http({
 +     method: "POST",
 +     url: restConfig.server.restServerUrl+"user/connect",
 +     data: $.param(response.posted),
 +     headers: self.headers
 + });
 + request.success(function(data, status, headers, config) {
 + callback(data);//Connexion réussie
 + }).error(function(data, status, headers, config){
 + self.addMessage({type: "warning", content:"Erreur de connexion au serveur, statut de la réponse : "+status+"<br>"+data.message});
 + });
 +}
 +</sxh>
 +<html>
 +<h3>Conserver la session (PHP) avec Angular :</h3>
 +Il suffit de décommenter la ligne <strong>withCredentials = true</strong> dans le fichier <strong>js/config.js</strong>
 +</html>
 +<sxh javascript;title:js/config.js;highlight:[3]>
 +module.exports=function($routeProvider,$locationProvider,$httpProvider) {
 + //$httpProvider.defaults.useXDomain = true;
 + $httpProvider.defaults.withCredentials = true;
 +</sxh>
 +<html></div></div></html>
 ===== -- Brasseurs ===== ===== -- Brasseurs =====
  
  • slam4/richclient/angularjs/project/openbeerdatabase/rest.1425942529.txt.gz
  • Dernière modification : il y a 6 ans
  • (modification externe)