0

Apologies for my english,

I am trying to use ember-data with one api and some resources of the api need the auth_code parameter.

example of my router:

@resource 'movies' , ->
  @route 'free'
  @route 'featured'
  @route 'favorites' , path: '/favorites'  #favorites need auth_code
  @route 'movie', path: '/:movie'

In MoviesFavoritesRouter i have :

model: ->
  App.Movie.find()

But how can insert the auth_code param using ember-data ?? or i have to do with jquery?

Ember.$.ajax(url: '/movies/favorites.json', ......, ...... )

thanks in advance

4

1 回答 1

0

您应该能够通过执行以下操作将自定义标头添加到您的 ajax 调用中:

DS.RESTAdapter.reopen({
  headers: {
    "AUTH_CODE": "secret",
    "ANOTHER_HEADER": "foobar"
  }
});

希望能帮助到你。

于 2013-09-02T17:32:21.720 回答