Skip to content

Instantly share code, notes, and snippets.

@feanor07
Created December 19, 2017 07:08
Show Gist options
  • Save feanor07/84b45a9d969ce367483a3011fb73ad28 to your computer and use it in GitHub Desktop.
Save feanor07/84b45a9d969ce367483a3011fb73ad28 to your computer and use it in GitHub Desktop.
so#47875621
import Ember from 'ember';
export default Ember.Controller.extend({
"funnelContent": {
"City": {
"testingAttribute": "Hello City!",
"one_number": 0,
"other_number": 0
},
"Other City": {
"testingAttribute": "Hello Other City!",
"one_number": 0,
"other_number": 0
},
"Kitchener-Waterloo": {
"testingAttribute": "Hello Kitchener-Waterloo!",
"one_number": 0,
"other_number": 0
}
},
init() {
this.set("selectedOffice", "Kitchener-Waterloo");
},
actions: {
changeOffice() {
if (this.get('selectedOffice')==='City') {
this.set('selectedOffice', 'Other City');
} else if (this.get('selectedOffice') === 'Other City') {
this.set('selectedOffice', 'Kitchener-Waterloo');
} else if (this.get('selectedOffice') === 'Kitchener-Waterloo') {
this.set('selectedOffice', 'City');
}
}
}
});
<h3>The selected office:</h3>
<h4>{{selectedOffice}}</h4>
<h3>The concat thing</h3>
<h4>{{concat selectedOffice '.testingAttribute'}}</h4>
<h3>The amazing title:</h3>
<h4>{{get funnelContent (concat selectedOffice '.testingAttribute')}}</h4>
<br>
<button onclick={{action "changeOffice"}}>Change Selected Office</button>
{
"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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment