HI, first of all i’m completely new on this one.
I’m creating an app that use json file to store data. Is it possible to update the json file, like download a new json file from a server then replace the old one inside the app ? is there such a thing like that ?
also i’m using this code to read json file
.factory('Lessons', function($q, $timeout, $http) {
.factory('Lessons', function($q, $timeout, $http) {
var lessons = {
fetch: function(callback) {
var deferred = $q.defer();
$timeout(function() {
$http.get('js/lessons.json').success(function(data) {
deferred.resolve(data);
});
},
30);
return deferred.promise;
},
//index lookup
get: function(lessonsId) {
return lessons[lessonsId];
}
};
return lessons;
})
the result is my app became laggy and the page change animation doesn’t work. also the back button doesn’t work like if i just put the json array inside the factory. is there something wrong with my code ?