When I use the Ember Router, how can I define actions in the template who are connected to the controller?
An Example is here: http://jsfiddle.net/KvJ38/3/
Unter My Profile are two actions: One is defined on the State, and is working Two is defined on the Controller. How can i make this working or should I use another approach?
App.Router = Em.Router.extend({
enableLogging: true,
location: 'hash',
root: Em.State.extend({
// EVENTS
goHome: Ember.State.transitionTo('home'),
viewProfile: Ember.State.transitionTo('profile'),
// STATES
home: Em.State.extend({
route: '/',
connectOutlets: function(router, context) {
var appController = router.get('applicationController');
appController.connectOutlet(App.HomeView);
}
}),
// STATES
profile: Em.State.extend({
route: '/profile',
connectOutlets: function(router, context) {
var appController = router.get('applicationController');
appController.connectOutlet(App.ProfileView);
}
}),
one: function() {
alert("eins");
},
})
});