Skip to content

Instantly share code, notes, and snippets.

@piotrpalek
Created November 10, 2016 11:04
Show Gist options
  • Save piotrpalek/349ce3ec2bb2092cad28e8c347da913e to your computer and use it in GitHub Desktop.
Save piotrpalek/349ce3ec2bb2092cad28e8c347da913e 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('books', function() {
this.route('show', { path: '/books/:id' });
});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model({ id }) {
return [1, 2, 3, 4, 5];
}
});
<style>
.container {
display: flex;
}
.page {
margin-left: 20px;
padding-left: 20px;
border-left: 1px solid black;
}
a.active {
color: red;
}
</style>
<div class="container">
<ul>
<li>{{link-to "Application" "application"}}</li>
<li>{{link-to "Books" "books"}}</li>
<li>{{link-to "Book #2" "books.show" 2}}</li>
</ul>
{{outlet}}
</div>
<div class="page">
<ul>
{{#each model as |bookID|}}
<li>{{link-to (concat "Book " bookID) "books.show" bookID}}</li>
{{/each}}
</ul>
</div>
{{outlet}}
<div class="page">
BookXXX
</div>
{
"version": "0.10.6",
"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.9.0",
"ember-data": "2.9.0",
"ember-template-compiler": "2.9.0",
"ember-testing": "2.9.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment