I used the json example from this site (at the bottom) https://dev.twitter.com/rest/reference/get/statuses/home_timeline, copied it to a file on my local file system and then tried to get it via Angular's $http service like this:
First I defined a service:
Services.TwitterService = function ($http) {
'use strict';
var TwitterService = {
getHome: function () {
return $http.get("ws/home.json").then(function (response) {
return response.data;
});
}
};
return TwitterService;
};
Then in my controller:
$scope.twitter = TwitterService;
TwitterService.getHome().then(function (data) {
$scope.twitter.home = data;
});
Unfortunately when I run the code, there seems to be a problem with a "/" character in the json because I get this exception:
SyntaxError: Unexpected token / at Object.parse (native)
Is Twitter's example json malformed or did I do something wrong? If the json file is invalid what can I do to fix it? Do I have to replace all occurrences of "/"?