$http(config) syntax?

5,639 views
Skip to first unread message

drjason...@gmail.com

unread,
May 24, 2012, 12:20:57 PM5/24/12
to ang...@googlegroups.com
Hi

Could anyone help by giving a fuller example of $http(config)?

Specifically I'd like to understand the syntax for the parameters after method: and url:.

So, just a fuller example would be great.  I might then better understand the documentation http://docs.angularjs.org/api/angular.module.ng.$http.

Many Thanks
Jason

Vojta Jína

unread,
Jun 12, 2012, 10:53:13 PM6/12/12
to ang...@googlegroups.com
$http({
  method: 'GET',
  url: '/some/url.py',
  params: {
    search: 'something' // will result in url /some/url.py?search=something
  },
  data: '..... data for post/put requests...',
  headers: {
    'Accept': 'application/json'
  },
  cache: true,
});

Is there anything particular that is not clear ?

V.


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/TrS7mQADso4J.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Dormouse

unread,
Aug 28, 2013, 4:27:05 PM8/28/13
to ang...@googlegroups.com
For me it still is, yes. Let me clarify:
$http gets injected in your service or controller bij AngularJS. Doing $http({withCredentials:true}) for example results in an undefined object at this point.
Where does the statement need to be defined? Seems to me it should be done during initialization?

-D
Reply all
Reply to author
Forward
0 new messages