Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Created August 3, 2017 05:19
Show Gist options
  • Save kumkanillam/915ac6406df17e964db78dc5dca0fe2a to your computer and use it in GitHub Desktop.
Save kumkanillam/915ac6406df17e964db78dc5dca0fe2a to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Controller.extend({
selectedIndex:undefined,
actions:{
changeSelectedIndex(index){
this.set('selectedIndex',index);
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model(){
return [1,2,3,4];
}
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.highlight{
border:1px solid red;
}
<h1>Welcome to {{appName}}</h1>
<br>
<div class="parent">
<ul>
{{#each model as | temp index|}}
<li class={{if (eq selectedIndex index) 'highlight' }} {{action 'changeSelectedIndex' index}}>{{temp}}</li>
{{/each}}
</ul>
</div>
<br>
{{outlet}}
<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.7.3",
"ember-template-compiler": "2.7.3",
"ember-testing": "2.7.3"
},
"addons": {
"ember-truth-helpers": "1.3.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment