if i got a route in ember.js which has a dynamic segment called “:albumid”, how do i access this from within the view?
Ember.Route.extend({
route: "/:albumid"
})
The Parameter is set like this:
gotoAlbum = function(r,e) {
router.transitionTo("album", {albumid: StuffThatReturnsTheAlbumid});
}
You’ll need to use the albumid param in the
deserialize()method of your route to return a context object. This context will be passed intoconnectOutlets()for your route. WithinconnectOutlets()you can pass the context along to the controller and/or view.In the example below, an AlbumController will be created in which its
contentproperty is set to be the context passed intoconnectOutlets(). An AlbumView will also be created, which will have access to the controller’scontent: