Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ember-cli-auto-complete
Advanced tools
ember-cli addon that provides type-ahead selection for text inputs
ember-cli addon that provides type-ahead selection for text inputs
npm install ember-cli-auto-complete --save-dev
First add a custom component that extends the AutoComplete component. In this component you will need to declare 2 computed properties.
1) the suggestions computed that will let you define a filter function
2) the options that are available for the end user
import AutoComplete from "ember-cli-auto-complete/components/auto-complete";
export default AutoComplete.extend({
suggestions: function() {
var inputVal = this.get("inputVal") || "";
return this.get("options").filter(function(item) {
return item.get("value").toLowerCase().indexOf(inputVal.toLowerCase()) > -1;
});
}.property("inputVal", "options.@each"),
optionsToMatch: function() {
var caseInsensitiveOptions = [];
this.get("options").forEach(function(item) {
var value = item.get("value");
caseInsensitiveOptions.push(value);
caseInsensitiveOptions.push(value.toLowerCase());
});
return caseInsensitiveOptions;
}.property("options.@each")
});
Next prepare a list of options for the component with both a value and label property
export default Ember.Route.extend({
model: function() {
var options = [];
options.pushObject(Foo.create({value: "ABC", label: "SOMETHING 1"}));
options.pushObject(Foo.create({value: "ABCD", label: "SOMETHING 2"}));
options.pushObject(Foo.create({value: "ABCDE", label: "SOMETHING 3"}));
return Ember.RSVP.hash({
model: Bar.create(),
options: options
});
},
setupController: function(controller, hash) {
controller.set("model", hash.model);
controller.set("options", hash.options);
}
});
Now add the html to your template for the custom component you declared above.
{{my-auto-complete options=options selectedValue=model.code placeHolderText="Find a thing" noMesssagePlaceHolderText="No things are found" showValue=true}}
1) you must pass in options (again- value/label are the expected properties)
2) selectedValue should be model bound
3) optional placeHolderText for the input
4) optional placeHolderText for the no match message
5) if you wish to show the value in the dropdown (along side the label) set this to true
npm install
bower install
ember test
1) npm install
2) bower install
3) ember server
4) 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
FAQs
ember-cli addon that provides type-ahead selection for text inputs
The npm package ember-cli-auto-complete receives a total of 2 weekly downloads. As such, ember-cli-auto-complete popularity was classified as not popular.
We found that ember-cli-auto-complete demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.