Currently, I have data being retrieved from a jsonp file within my application.
worm.factory('simpleFactory', function ($http, gf) {
var simpleFactory = "";
return {
getJson: function ($scope) {
var url = 'myfile.json?callback=JSON_CALLBACK';
$http.jsonp(url).success(function (data) {
console.log("Received data:", data);
}).error(function (data, status, headers, config) {
console.log("Data is not accessible");
});
}
}
});
This functionality works perfectly on the page on its own. However, if the same request is made again within the app or if the app is duplicated elsewhere on the page (to display different parts of a graph with the same data), an error occurs.
Since the json file is static, how can I resolve this issue? Is there a way to run the same app on the same page but keep them isolated from each other?