Hi Michael!
The callback function you can pass to a resource's get function can
receive the same params as the $http
(
http://docs.angularjs.org/api/ng.$http) get method, that is:
data – {string|Object} – The response body transformed with the
transform functions.
status – {number} – HTTP status code of the response.
headers – {function([headerName])} – Header getter function.
config – {Object} – The configuration object that was used to generate
the request.
Would be far, far easier to have a jsFiddle (even if broken!) but you
should be doing sth like:
Logins.get({[your query criteria here]}, function(data, status, headers){
//you've got access to headers here
});
In short a resource object is just a wrapper for the $http service.
Hope it clarifies things a bit but feel free to send a jsFiddle (once
again, even broken) so we can collaborate on a piece of code.
Cheers,
Pawel
On Mon, Jul 23, 2012 at 9:23 PM, Michael Bielski
<
michael...@yahoo.com> wrote:
> I'll start by apologizing up front because I am very new to the Angular
> community. I've been through the tutorial and I guess I still just don't get
> it. I'm trying to create a resource and the problem that I have run into is
> that I need to get the value of a specific header when a GET call is made,
> and for the life of me I can't seem to figure out how to do this. I've been
> searching and reading all morning, but apparently my Google-Fu needs some
> work. Here's where I left off trying before posting:
>
> function loginController($scope, Logins, $http) {
> $scope.doLogin = function () {
> var myToken = Logins.get(function (getResponseHeaders) { return
> getResponseHeaders("Auth-Nonce"); });
> $scope.stats = myToken;
> }
> }
>
> angular.module('loginService', ['ngResource']).factory('Logins', function
> ($resource) {
> return $resource("/v1/rest/auth/:usrId/:pwdVal", { usrId: "", pwdVal: ""
> }, {
> checkUser: { method: "GET", params: { usrId: "@user", pwdVal: "@pwd"
> }, isArray: false, headers: { "Auth-Nonce-Response": "@nonce"} },
> getSeat: {},
> logOut: {}
> });
> });
>
> Any help would be greatly appreciated.
>
> --
> 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/-/k9gIc_ZlljMJ.
> 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.