Possible to make a route transition inside of a service in Ember?

后端 未结 3 1452
轻奢々
轻奢々 2021-01-12 23:16

I\'m using ember-cli 1.13.8 and I have a service that handles most of my logic. Right now I have a function that listens to whether certain things are true or false and then

3条回答
  •  广开言路
    2021-01-12 23:53

    You can use the routing service (which is a private API):

    routing: Ember.inject.service('-routing'),
    
    init() {
      ... 
      if(true) {
        console.log("you've won!");
        this.get("routing").transitionTo("congratulations");
      }
    },
    

提交回复
热议问题