ember-model-select
An ember-cli addon to provide a searchable model select box with infinite scroll support.
The addon composes ember-power-select, ember-infinity and ember-concurrency to provide an easy to use generic model select box based on ember-data models. It can be used in any place where one might want to search for models without the need for extra JavaScript code.
Installation
ember install ember-model-select
Usage
An example page can be found here.
{{model-select
modelName='user'
labelProperty='name'
selectedModel=selectedModel
onchange=(action (mut selectedModel))
}}
There is also a withCreate option which can be enabled by passing withCreate=true
. The onCreate
hook is called with the search term. An optional buildSuggestion
function can be passed to construct the text shown in the create option. This defaults to Add "<term>"...
.
{{model-select
modelName='user'
labelProperty='name'
selectedModel=selectedModel
onChange=(action (mut selectedModel))
withCreate=true
oncreate(action 'createModel')
}}
NOTE: Extensive documentation is TBD. For now usage is documented in the main component file.
Related addons
Copyright and license
Code and documentation copyright 2018 Wedding Shoppe Inc. and contributors. Code released under the MIT license.