I am using AngularJS
and currently working with static text files to get data.
I used factory
to return a $resource
as,
app.factory('TimeSeriesData', function ($resource) {
return $resource('data/timeSeriesData.txt');
});
I also tried to $http
but AngularJS
was trying to parse it as JSON using this function in angular.js
function fromJson(json) {
return isString(json)
? JSON.parse(json)
: json;
}
I just have plain text data in the text file which is not in a JSON format. The parsing is causing an error in the console.
How do I avoid AngularJS
to stop parsing it as JSON ?