Zalizan Zolkipali
Zalizan Zolkipali

Reputation: 123

angular ngresource can't send headers

I'm new to the angularjs/ionic mobile app development. I'm using Parse REST api to store data and already hosted Parse server in Heroku. Tested with postman chrome extension and everything working fine. The problem that i'm facing right now is my angular-resource seem look like not sending any headers used to authenticate with parse to the server.

angular.module('starter.services', ['ngResource']).factory('Session', function ($resource) {

return $resource('/restapiurl', {}, {
    get: {
        method:'GET',
        headers:{'X-Parse-Application-Id':'XXX', 'X-Parse-REST-API-Key':'XXX'}
    } 
  }); 
});

Need an advice/guide to make my code work perfectly. Any help would be appreciate. Thanks in advance

UPDATE: I'm managed to send custom headers to the server. The workaround is to use $httpProvider.defaults.headers.common with the key and value inside module.config

Upvotes: 1

Views: 64

Answers (0)

Related Questions