Skip to content

Instantly share code, notes, and snippets.

@juggy
Last active December 10, 2015 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juggy/e30d73a32b81e40db356 to your computer and use it in GitHub Desktop.
Save juggy/e30d73a32b81e40db356 to your computer and use it in GitHub Desktop.
nested routes
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
building: Ember.computed(function(){
return {id: 1, name: "BUILDING!"}
})
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#link-to "buildings.show" building}}
standalone building
{{/link-to}}
{{!--#link-to "contacts.buildings.show" building}}
contacts building
{{/link-to--}}
{{#link-to "projects.buildings.show" building}}
projects building
{{/link-to}}
{{outlet}}
<br>
<br>
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route("buildings", function(){
this.route("show", {path: "/:building_id"});
});
this.route("contacts", function(){
this.route("show", {path: ":/id"});
this.route("buildings", {resetNamespace:true}, function(){
this.route("show", {path: "/:building_id"});
});
});
this.route("projects", function(){
this.route("show", {path: ":/id"});
this.route("buildings", {resetNamespace:true}, function(){
this.route("show", {path: "/:building_id"});
});
});
});
export default Router;
{
"version": "0.4.17",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.2.0",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "2.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment