How to work with controller from router in ember js

Folks,

We will just wrap up on coding in achieving how to work with controller from router in ember js

Step1:

App.Router.map(function(){
this.resource(‘photos’);
});

Step2:

App.PhotosRoute = Ember.Route.extend({

renderTemplate: function(controller){
this.render(‘photos’, {controller: controller});
}
});

Step3:
App.PhotosController = Ember.ArrayController.extend({
currentIndex: 0,

actions: {
displayPic: function () {

},
previous: function () {
alert(“previous”);
},
next: function () {
alert(“next”);

}
}
});

For examples: Clickhere

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s