
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
angular-szn-autocomplete-build
Advanced tools
An AngularJS directive to display suggestions while typing into text input.
This is a fork of Jiří Kuchta's angular-szn-autocomplete (https://github.com/jirikuchta/angular-szn-autocomplete) with a bit of tweaks such as:
sznAutocomplete-enter event when enter key is pressed in the input field##Description
An AngularJS directive providing suggestions as you type into text input.
Features:
Requirements: AngularJS 1.2.x or 1.3.x
File size: 2.42KB gzipped (8.55KB uncompressed)
1. Download via npm or bower
$ npm install angular-szn-autocomplete-build
$ bower install angular-szn-autocomplete-build
(or simply download zip file and copy the angular-szn-autocomplete.js and angular-szn-autocomplete.css files into your project)
2. Link the files in the page header
<script src="/path-to-file/angular-szn-autocomplete.js"></script>
<link rel="stylesheet" href="/path-to-file/angular-szn-autocomplete.css">
3. Include the module as a dependency in your app
angular.module("myApp", ["angular-szn-autocomplete"])
There are two ways how to configure the directive. Either you can pass a configuration object
<input type="text" ng-model="query" szn-autocomplete="options">
or configure the directive via element attributes. For example:
<input type="text" ng-model="query" szn-autocomplete highlight-first="true">
Settings set via element attributes have higher priority and override settings from the configuration object (if both ways are used).
List of possible settings:
(default: false) Whether to automatically hightlight first item in suggestions results.(default: 0) Used when hightlighting the first item in the result popup to specify the index to highlight first.(default: false) keydown not going to the first item when reaching the last menu item. Keyup not going to the last item when reaching the first item. no loop(default: false) Don't display the no result message(default: false) Whether to show a hint.(default: "getAutocompleteResults") Allows set custom name of scope function that provides suggestions data. Read more.(default: input parent element) A CSS selector of an element in which the popup should be appended into.(default: input parent element) A CSS selector of an element in which the shadowInput should be appended into.(default: 100) Time in ms to wait before calling the searchMethod.(default: 1) Number of characters that needs to be entered before the directive does any work.(default: true) Should the matches in suggestion be bold?All attributes are optional and everything should work fine without any customization as far as the getAutocompleteResults method is defined in the scope (more).
In order to obtain data, the directive calls scope function named getAutocompleteResults (name of the function can be changed via "searchMethod" option). It is up to you what logic you put into this function to get the data (i.e. searching within some static object or sending an HTTP request).
Two argument are passed to the function:
You are supposed to use the query string to perform your search and then resolve the deferred object with results data object. See example.
All data you return will be accessible in the popup template, so put everything you want to display in the popup into it. There is one requirement on the structure of the data - the returned object has to contain results array which has objects as its items. Each item has one mandatory key value that holds the suggested string. Example:
{
"results": [
{
"value": "foobar",
// any custom data
}
]
// any custom data
}
You can specify if an item is selectable or not by adding a key disable set to true. Example:
{
"results": [
{
"value": "foobar",
"disable": true,
// any custom data
}
]
// any custom data
}
The directive emits following events allowing further customization:
sznAutocomplete-init: emitted when the directive is initializedsznAutocomplete-show: emitted each time the suggestions list showssznAutocomplete-hide: emitted each time the suggestions list hidessznAutocomplete-select: emitted when some suggest item is selected. The selected item data is passed in the event data objectsznAutocomplete-enter: emitted when the enter key is pressed in the input fieldLicensed under the MIT license
FAQs
An AngularJS directive to display suggestions while typing into text input.
We found that angular-szn-autocomplete-build demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.