简体   繁体   中英

Ember.js 1.0rc6 - RSVP is not defined

I'm following the example on how to make an authenticated route here: https://gist.github.com/machty/5647589

However when I run this code:

App.AuthenticatedRoute = Ember.Route.extend({
  beforeModel: function(transition) {
    if (!authTokenPresent) { 
      return RSVP.reject();
    }
  }
}

I get:

Uncaught ReferenceError: RSVP is not defined 

I'm pretty new to this whole promises thing, so I assumed this was something just baked into ember for rejecting a promise. Should I be doing something different here?

I'm pretty new to this whole promises thing, so I assumed this was something just baked into ember for rejecting a promise. Should I be doing something different here?

Try Ember.RSVP.reject . The RSVP module is prefixed with the Ember namespace when used in ember, see here .

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM