Closed desouzamaria closed 8 years ago
By 'resource comes undefined.' you mean $jsonapi.getResource('test') === undefined
?
Yes.
Also, I have a simple app to test the API where I get the results using $http. And this works: $http.get(restUrl,{query: { method:'GET', isArray: false }}).success(function(res) { $scope.test = res.data; });
@desouzamaria that's 99% your fault :). Have u called $jsonapi.addResource(schema, synchronizer);
? and is the schema.type
same as the resource name u are trying to get with $jsonapi.getResource
? (in your example test
)
I also recommend you checking demo
directory, especially code in demo/resources/*
.
If you are 100% sure everything is ok, please provide me with some more specific example, so I can recreate the issue.
@jakubrohleder I certainly do have this line, after I create the synchronizer: $jsonapi.addResource(schema, synchronizer);
Also, I made sure the schema.type is same as the resource name. As I said before It works when I have the local store defined and passed to synchronizerSimple.create.
I have got down your demo example and checked it.
Perhaps you can give an example of a factory and controller that does not use the local store.
Thanks
@desouzamaria Sorry for the long time waiting, I did not manage to prepare demo for you earlier. Have you solved this issue already? If not I'll prepare a no-local-store demo for you.
@desouzamaria Sorry for the long time waiting, I did not manage to prepare demo for you earlier. Have you solved this issue already?
If not I'll prepare a no-local-store demo for you.
Thanks. We are currently using another way of integrating with the API.
@desouzamaria Can you please let me know What is other way of integrating with the API.
We are having some problems with the local storage cache mainly the size causing erratic behavior.
Can we easily set it not to use local store for our development phase.. I used this. But resource comes undefined. //factory var restSynchro = $jsonapi.sourceRest.create('Rest source', restUrl); var synchronizer = $jsonapi.synchronizerSimple.create([ restSynchro]);
//controller var resource = $jsonapi.getResource('test');
If I use the local store it works: //factory var localeSynchro = $jsonapi.sourceLocal.create('LocalStore synchronization', 'app'); var restSynchro = $jsonapi.sourceRest.create('Rest source', restUrl); var synchronizer = $jsonapi.synchronizerSimple.create([localeSynchro, restSynchro]);