ember-cli addon that provides type-ahead selection for text inputs (requires ember.js 1.11+)
npm install ember-cli-auto-complete --save-dev
First add a custom component that extends AutoComplete. In this component you need to add 2 computed properties and 1 string variable.
1) suggestions: this computed will determine how the list of options is filtered as the user enters text2) optionsToMatch: this computed will determine if the value entered is valid (when the user omits to click/enter/tab the selection)3) valueProperty: this string should be the value property for the options passed in (think selectbox value/label)
Next add the component to your template including a block with html for the options (requires ember 1.11)
#my-auto-complete options=codes inputClass="foobar" selectedValue=modelcode placeHolderText="Find a thing" noMesssagePlaceHolderText="No things are found" as |result|<p><b>resultcode</b>resulttext</p>/my-auto-complete
Finally prepare a list of options for the component in the route or controller
var Foo = EmberObject;var Bar = EmberObject;Route;
If you would like to call an action every time an elements is
selected just bind the action through the attribute
#my-auto-completeoptions=codesselectedValue=modelcodeplaceHolderText="Find a thing"inputClass="my-fun-input-thing andTwo"noMesssagePlaceHolderText="No things are found"selectItem="itemSelected" as |result|<p><b>resultcode</b>resulttext</p>/my-auto-complete<p class="selection">controllerselection</p>
In the example above the action
itemSelected will be called with the
item, bubbling through your routes and controllers.
npm install bower install ember test
1) npm install2) bower install3) ember server4) localhost:4200
First I'd like to thank Nick Christus for the design work that made this great component happen to begin with. Next I'd like to thank Charlie for his amazing project ember-cli-suggest as this project truly represents a fork of his work.
Copyright © 2015 Toran Billups http://toranbillups.com
Licensed under the MIT License