$http.get not working


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 = [];

.success(function(data, status, headers, config){
people = result.data;
.error(function(data, status, headers, config){

return {
all: function() {
return people;

.controller(‘myapp’, function($scope, People) {

$scope.people = People.all;


Content within ionic-content tags not displaying properly

seems more like a straight angular question? you might want to try stackoverflow


The Ionic library is involved. Here is debugger output from a variant of the above code:

@file:///home/adrien/ionic_projects/myapp/www/js/app.js:66 qFactory/defer/deferred.promise.then/wrappedErrback@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:18444 qFactory/defer/deferred.promise.then/wrappedErrback@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:18444 qFactory/defer/deferred.promise.then/wrappedErrback@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:18444 qFactory/createInternalRejectedPromise/<.then/<@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:18576 $RootScopeProvider/this.$get</Scope.prototype.$eval@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:19447 $RootScopeProvider/this.$get</Scope.prototype.$digest@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:19273 $RootScopeProvider/this.$get</Scope.prototype.$apply@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:19553 done@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:15311 completeRequest@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:15512 createHttpBackend/</xhr.onreadystatechange@file:///home/adrien/ionic_projects/myapp/www/lib/ionic/js/ionic.bundle.js:15458


Don’t you mean People.all instead of People.query?


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.


if you dont use promises, does it work?

$http({method: 'GET', url: 'http://localhost:3000/people'})
  .success(function(data) {
    $scope.people = data;


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.


You’re probably going to need to create a CodePen sample for us to be much more help. It’s hard to troubleshoot with just a few snippets of code.


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!