Skip to content

Instantly share code, notes, and snippets.

@shawnren
Forked from feanor07/controllers.application.js
Last active December 21, 2017 01:00
Show Gist options
  • Save shawnren/af398f07921fbdabba2746d4ae024a32 to your computer and use it in GitHub Desktop.
Save shawnren/af398f07921fbdabba2746d4ae024a32 to your computer and use it in GitHub Desktop.
route-original
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('doctor', function() {
this.route('visit', {
path: '/visit/:visit_id'
}, function() {
this.route('order');
});
});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return 'this is doctor route';
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
return 'this is visit route ' + params.visit_id;
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return 'this is order route';
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#link-to 'doctor'}}Link for doctor route{{/link-to}}
<br>
{{#link-to 'doctor.visit' 2}}Link for doctor/visit/2 route{{/link-to}}
<br>
{{#link-to 'doctor.visit.order' 2}}Link for doctor/visit/2/order route{{/link-to}}
<br>
{{outlet}}
<br>
<br>
{{model}}
<br>
{{outlet}}
{{model}}
<br>
{{outlet}}
{
"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