Skip to content

Instantly share code, notes, and snippets.

@luxzeitlos
Last active November 8, 2018 18:46
Show Gist options
  • Save luxzeitlos/9fbfc74f69fbe7127fcb58d8eb3e62ff to your computer and use it in GitHub Desktop.
Save luxzeitlos/9fbfc74f69fbe7127fcb58d8eb3e62ff to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
activate(name) {
if(this.currentTab === name) {
this.set('currentTab', '');
} else {
this.set('currentTab', name);
}
}
}
});
<ul>
<li role="button" onclick={{action 'activate' 'tab1'}}>Tab1</li>
<li role="button" onclick={{action 'activate' 'tab2'}}>Tab2</li>
</ul>
{{#if (eq currentTab 'tab1')}}
<div>
Tab 1
</div>
{{/if}}
{{#if (eq currentTab 'tab2')}}
<div>
Tab 2
</div>
{{/if}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2",
"ember-truth-helpers": "2.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment