If this link is inside the DOM element, which is a child of the Ember managed element, you can use the action helper:
<a id="login" href="#" {{action doSomeStuff}}>Login</a>
This doSomeStuff event will be dispatched to your Ember.Router , which the handler should implement on the assigned route:
...: Ember.Route.extend({ doSomeStuff: function (router) { //... } }),
If the link is outside the scope of the application, you can register handlers for application-related elements using jQuery:
$('a#login').click(function () { App.router.transitionTo('the.route.path'); });
App.router is entered into the initialization of the Ember application, you can access it from anywhere.
But let me say that switching from an external router is not recommended.
Last but not least, you can also pass context to the transitionTo call.
source share