Thx Stephen for your answer !
I wanted to create two services. That's why i have done it.
Now, I try to simplify my *services*.js with :
var myApp = angular.module('regiePub');
*// first service*
myApp.factory('Ogec',['$resource',
function($resource){
return $resource('data/ogec.json', {}, {
listerOgec: {method:'GET', isArray:true}
});
}]);
*// second service*
myApp.factory('unOgec',['$resource',
function($resource){
return $resource('data/resultat.json', {}, {
query: {method:'GET', isArray:true}
});
}]);
But I have the same problem
*console.log("test: " + unOgec.query() ); * => *it returns me no data* ....
However my first service returns me all data.
Le jeudi 13 mars 2014 11:11:17 UTC+1, Stephen Friedrich a écrit :
>
> The problem is that
> angular.module('*unOgecService*',['ngResource']);
> _creates_ the module.
> To only get a reference to the module use
> angular.module('*unOgecService*');
> IMHO that API is seriously broken.
> Would be much better to have two separate method to create vs, get a
> module.
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.