3
votes

In emberjs pre2 we could access router from any where like

App.get('router')

Can anybody suggest what could be the similar code for emberjs rc1?

Thanks

1
What's your use case? I believe the router is isolated for a reason. If you just want to transition to another route, from within the controller you can do something like this this.get('target').transitionTo('other.route') and from within a route you simply do this.transitionTo('other.route')MilkyWayJoe

1 Answers

5
votes

Can anybody suggest what could be the similar code for emberjs rc1?

Emberjs rc1 does not expose the router in this way.

As an alternative you should access router via local references.

It's not just the router, pretty much everything that used to be accessible via global constants is now hidden. This is because using global constants to access instances breaks encapsulation, and while that is fine for the console it should be avoided in your application code.