Skip to content

Instantly share code, notes, and snippets.

@sumn2u
Created September 17, 2015 13:30
Show Gist options
  • Save sumn2u/491c8ee3abd5046e0a79 to your computer and use it in GitHub Desktop.
Save sumn2u/491c8ee3abd5046e0a79 to your computer and use it in GitHub Desktop.
Select in Ember
import Ember from 'ember';
export default Ember.Route.extend({
// campaigns: this.store.findAll('campaigns'),
model: function(){
return Ember.RSVP.hash({
campaigns: this.store.findAll('campaigns'),
leads: this.store.findAll('leads')
});
},
setupController:function(controller,model){
controller.set('model',model);
controller.set('selectedCampaign',model.campaigns.get('firstObject.id'));
},
actions: {
check(){
console.log("sdafhskajdfhk");
console.log(this.get('controller.selectedCampaign'));
}
}
});
/*{{view "select"
content = model.campaigns
optionLabelPath="content.name"
optionValuePath="content.id"
value=selectedCampaign
}}
<button {{action "check"}}>Go</button>*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment