Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
opportunity-select
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#link-to 'opportunities'}}Opportunities{{/link-to}}
{{outlet}}
<br>
<br>
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return [
{id:0, name: 'opportunity1'},
{id:1, name: 'opportunity2'}
]
}
});
{{opportunity-select opportunities=model}}
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'select',
class: 'selectpicker',
selectedOpportunityId: null,
didInsertElement: function(){
this.$().selectpicker();
Ember.run.scheduleOnce('afterRender', this, () => $(this.get('element')).selectpicker());
// Ember.run.scheduleOnce('afterRender', this, () => this.$().selectpicker());
}
});
{{#each opportunities as |opportunity|}}
<option>
{{opportunity.name}}
</option>
{{/each}}
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('opportunities', function() {
});
});
export default Router;
{
"version": "0.4.10",
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.9/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.11/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.9/ember-template-compiler.js",
"bootstrap-select": "https://raw.githubusercontent.com/silviomoreto/bootstrap-select/master/dist/js/bootstrap-select.min.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment