Skip to content

Instantly share code, notes, and snippets.

@machty
Last active October 15, 2017 14:51
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 machty/2f4e26c1c18d71a656a5eaf37e1e0b3f to your computer and use it in GitHub Desktop.
Save machty/2f4e26c1c18d71a656a5eaf37e1e0b3f to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('foo', { path: 'foo/:id' }, function() {
this.route('bar', { path: 'bar/:id' }, function() {
this.route('baz', { path: 'baz/:id' }, function() {
});
});
});
});
export default Router;
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{{link-to "click me" 'foo.bar.baz' 1 2 3}}
\{{link-to "click me" 'foo.bar.baz' 1 2 3}}
<br>
<br>
Notice that the URL changes to
/foo/1/bar/1/baz/1 ; this is
because Ember
(and internally, route-recognizer)
doesn't support multiple routes
in the same hierarchy using the same
param name.
<br>
<br>
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment