Attempting to get some json from the backend. Get an http code of 200, followed by 404. I’ve verified the backend is working and returning the json. The backend is Rails 4.0.4, and is using ETags. Here is my code:
.factory(‘People’, function($http) {
var people = [];
Yes, People.all, I changed it to that and it still doesn’t work. The new code I’m trying is placed directly in my .controller and it also doesn’t work:
var responsePromise = $http.get('http://localhost:3000/people');
responsePromise.then(function (response) {
$scope.people = response.data;
},function (response) {
throw new Error('Something went wrong...');
});
The backend works, I’ve verified it with curl. And the backend logfile shows a status 200 OK response.
No, still doesn’t work, and it also now makes 2 GET requests rather than just 1. Ah, my second approach also made 2 GET requests, but when I tried getting the data in a .factory it only made 1 request.
The example is pretty strait forward, and conforms to what I’ve read both in an Angular book and on this forum. I have deadlines to meet, so I need to go back to coding my apps natively. Ionic is a nice looking framework and a good piece of concept software. I’ll check in on it every so often and am looking forward to using it in a production app. Thanks!