Starting a better management of the 'models' and the requests
authorrougeronj
Fri, 22 May 2015 17:41:19 +0200
changeset 93 4b167851ee7d
parent 92 fabc568d88d1
child 94 cb4cf30a1629
Starting a better management of the 'models' and the requests
client/app/app.js
client/app/components/app_service.js
client/app/index.html
--- a/client/app/app.js	Fri May 22 14:50:23 2015 +0200
+++ b/client/app/app.js	Fri May 22 17:41:19 2015 +0200
@@ -1,7 +1,7 @@
 (function(){
     'use strict';
 
-    angular.module('ammico', [ 'ngRoute','ammicoHome', 'ammicoMyvisit', 'ammicoBooks', 'ammicoVisites', 'ammicoSlides', 'ammicoSlideshow', 'ammicoSearch', 'ammicoAuth', 'templates' ])
+    angular.module('ammico', [ 'ngRoute','ammicoHome', 'ammicoMyvisit', 'ammicoBooks', 'ammicoVisites', 'ammicoSlides', 'ammicoSlideshow', 'ammicoSearch', 'ammicoAuth', 'ammicoModels', 'templates' ])
     .config(function($routeProvider) {
         $routeProvider.
         when('/', {
--- a/client/app/components/app_service.js	Fri May 22 14:50:23 2015 +0200
+++ b/client/app/components/app_service.js	Fri May 22 17:41:19 2015 +0200
@@ -1,1 +1,16 @@
-'common service goes here';
\ No newline at end of file
+
+(function(){
+    'use strict';
+    
+    angular.module('ammicoModels', ['ngRoute'])
+    .factory('Book', function($resource, context) {
+        var books = $resource(context.urls.ammicoUrl+'/books/:idBook', {idBook:'@id'});
+        //return $resource('/api/posts/:id');
+        return books;
+    })
+    .factory('Slide', function($resource, context) {
+        return $resource(context.urls.ammicoUrl+'/slides/:idSlide', {idSlide:'@id'});
+        //return $resource('/api/posts/:id');
+    });
+    
+})();
--- a/client/app/index.html	Fri May 22 14:50:23 2015 +0200
+++ b/client/app/index.html	Fri May 22 17:41:19 2015 +0200
@@ -81,7 +81,7 @@
               record: angular.fromJson('{"record": "record value"}'),
               urls: {
                   base_static: "./",
-                  ammicoUrl: "http://0.0.0.0:8080/ammico",
+                  ammicoUrl: "http://127.0.0.1:8000/ammico",
                   searchUrl: "http://ammico.labs.exalead.com/search-api"
               }
           });