Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Created January 24, 2017 17:30
Show Gist options
  • Save kumkanillam/ec4c0a88555e85718c3aa66da81b8191 to your computer and use it in GitHub Desktop.
Save kumkanillam/ec4c0a88555e85718c3aa66da81b8191 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Component.extend({
init(){
this._super(...arguments);
this.set('stations',[]);
},
actions:{
switchGenre(){
console.log('switchGenre');
Ember.RSVP.resolve([{name:'A'},{name:'B'}]).then((result) => {
console.log('hi',result);
this.set('stations',result);
});
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
});
<h1>Welcome to {{appName}}</h1>
<br>
{{my-component }}
<br>
{{outlet}}
<br>
<br>
{{#each stations as |station|}}
{{station.name}}
{{/each}}
<button {{action 'switchGenre' }}>switchGenre</button>
{{yield}}
{
"version": "0.11.0",
"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.10.2",
"ember-data": "2.11.0",
"ember-template-compiler": "2.10.2",
"ember-testing": "2.10.2"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment