javascript - Angular $http.jsonp or get returning 404 on a mobile -
i pulling in json file storing locally. when view in browser works, when view in ionic packaged app returns 404
i using following code:
.factory('cardfactory', function ($q, $http, $rootscope) { return { getcards: function () { var deferred = $q.defer(), httppromise = $http.jsonp('/static/cards.json'); httppromise.then(function (response) { deferred.resolve(response); }, function (error) { console.error(error); }); return deferred.promise; } }; });
and calling so:
cardfactory.getcards() .then(cardsuccess, carderror);
i have tried instead of jsonp, both return 404 response.
i aware of access-control-allow-origin issue, surely jsonp should solve that? @ same level (hierarchically) images, served fine.
any ideas what's going on?
the solution change request simple get, , lose first slash so:
var httppromise = $http.get('static/cards.json');
Comments
Post a Comment