$http 404 error %5Bobject%20Object%5D

1,305 views
Skip to first unread message

Adrian Ferreres

unread,
Dec 28, 2013, 10:56:44 PM12/28/13
to ang...@googlegroups.com
Hello:

 I have two examples of AngularJS code. This is the first:

  $http.get("json/menuBar.json").success(function(data){
$scope.barra = data;
});

and this is the second:

  $http.get({method:'GET',url:'json/menuBar.json',cache:true,responseType:'json'}).success(function(data){
$scope.barra = data;
});

The first works fine but the second gives a 404 error because the get request is calling to an strange URL: "/Angular%20web/%5Bobject%20Object%5D". 
Does someone know where is my error?

Thank you in advance

Jeff Hubbard

unread,
Dec 28, 2013, 11:07:51 PM12/28/13
to ang...@googlegroups.com
$http.get() doesn't take a config object. Try using $http() instead.

Adrian Ferreres

unread,
Jan 2, 2014, 3:17:09 AM1/2/14
to ang...@googlegroups.com
Ok Jeff you are right. I do not know how I could not see it. 

Thank you very much


2013/12/29 Jeff Hubbard <lord...@gmail.com>

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/cDmg9elBi5c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages