Skip to content

Instantly share code, notes, and snippets.

@hjumeau
Last active January 25, 2016 10:24
Show Gist options
  • Save hjumeau/692bf3229d2f7eb1acfd to your computer and use it in GitHub Desktop.
Save hjumeau/692bf3229d2f7eb1acfd to your computer and use it in GitHub Desktop.
links
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
import Ember from 'ember';
export default Ember.Route.extend({
model(params){
return {id: params['comment_id'], content: 'welcome'};
}
});
<p>Comment n°{{model.id}}, content: {{model.content}}</p>
import Ember from 'ember';
export default Ember.Route.extend({
model(params){
return {
id:params['photo_id'],
primaryComment:{id: 1, content:'hello'}
}
}
});
<p>{{#link-to "photos.photo.comment" model.primaryComment}}Main Comment{{/link-to}}</p>
<p>
{{#link-to 'photos.photo.comment' 5 model.primaryComment}}
Main Comment for the Next Photo
{{/link-to}}
</p>
Photo n°{{model.id}}
{{outlet}}
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('photos', function(){
this.route('photo', { path: '/:photo_id' }, function(){
this.route('comments');
this.route('comment', { path: '/comments/:comment_id' });
});
});
});
export default Router;
{
"version": "0.5.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment