Skip to content

Instantly share code, notes, and snippets.

@zoltan-nz
Created April 2, 2016 10:16
Show Gist options
  • Save zoltan-nz/088c66cae53eb6a20e3ccfd22a521cbc to your computer and use it in GitHub Desktop.
Save zoltan-nz/088c66cae53eb6a20e3ccfd22a521cbc 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'
});
Router.map(function() {
this.route('item', { path: '/item/:item_id' });
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return params.item_id;
}
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.active {
background: blue;
color: #fff;
}
<h2>Hello</h2>
<ul>
<li>{{#my-link-to "index"}}Index{{/my-link-to}}</li>
<li>
All items
<ul>
<li>{{#link-to "item" 1}}Item 1{{/link-to}}</li>
<li>{{#link-to "item" 2}}Item 2{{/link-to}}</li>
<li>{{#link-to "item" 3}}Item 3{{/link-to}}</li>
<li>{{#link-to "item" 4}}Item 4{{/link-to}}</li>
<li>{{#link-to "item" 5}}Item 5{{/link-to}}</li>
</ul>
</li>
<li>
Group A
<ul>
<li>{{#link-to "item" 1}}Item 1{{/link-to}}</li>
<li>{{#link-to "item" 2}}Item 2{{/link-to}}</li>
<li>{{#link-to "item" 3}}Item 3{{/link-to}}</li>
</ul>
</li>
<li>
Group B
<ul>
<li>{{#link-to "item" 4}}Item 4{{/link-to}}</li>
<li>{{#link-to "item" 5}}Item 5{{/link-to}}</li>
</ul>
</li>
</ul>
<hr />
{{outlet}}
I am item {{model}}.
{
"version": "0.7.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": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment