{"id":14973515,"url":"https://github.com/orizens/ngx-typeahead","last_synced_at":"2025-04-13T06:35:52.203Z","repository":{"id":47451025,"uuid":"90112730","full_name":"orizens/ngx-typeahead","owner":"orizens","description":"A simple but yet powerful typeahead component for Angular (css framework agnostic)","archived":false,"fork":false,"pushed_at":"2024-06-20T22:59:42.000Z","size":993,"stargazers_count":61,"open_issues_count":29,"forks_count":28,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T09:16:41.164Z","etag":null,"topics":["angular","angular-library","angular6","angularjs","autocomplete","component","rxjs","typeahead"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ngx-typeahead","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orizens.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-03T05:47:02.000Z","updated_at":"2024-06-20T22:59:45.000Z","dependencies_parsed_at":"2024-09-23T13:31:03.960Z","dependency_job_id":"2b8f5cc9-4913-4c51-a3c9-7b90c5e6f505","html_url":"https://github.com/orizens/ngx-typeahead","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":"0.033333333333333326","last_synced_commit":"a76f52586fb08c0db339feda85e4304252123e26"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orizens%2Fngx-typeahead","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orizens%2Fngx-typeahead/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orizens%2Fngx-typeahead/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orizens%2Fngx-typeahead/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orizens","download_url":"https://codeload.github.com/orizens/ngx-typeahead/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248675250,"owners_count":21143763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-library","angular6","angularjs","autocomplete","component","rxjs","typeahead"],"created_at":"2024-09-24T13:48:53.634Z","updated_at":"2025-04-13T06:35:52.180Z","avatar_url":"https://github.com/orizens.png","language":"TypeScript","readme":"[![npm version](https://badge.fury.io/js/ngx-typeahead.svg)](https://badge.fury.io/js/ngx-typeahead)\n![npm](https://img.shields.io/npm/dt/ngx-typeahead.svg)\n![npm](https://img.shields.io/npm/dm/ngx-typeahead.svg)\n\n# Angular Typeahead Directive/Component (Standalone)\n\nThis is an extract of the typeahead component from the [open source](http://github.com/orizens/echoes-player) [Echoes Player](http://echoesplayer.com).\n\n## Data Sources Support\n\nIts built with **JSONP** support **by default**.  \nSupports **HTTP** remote source with any http method (get, post etc..).\nSupports static list (in array form).\n\n## Angular Support\n\nNow, ngx-typeahead now follows Angular versions, starting with **ngx-typeahead@6.0.0** for Angular 6.X.X.  \nFor **Angular 4.3/5.X** (With the new **HttpClient**)- please use version \u003e 0.2.1  \nFor **Angular 2, 4** (Without **HttpClient**)- please use version 0.0.3\n\nAOT compatible\n\n## Angular Consulting Services\n\nI'm a Senior Javascript Engineer \u0026 A Front End Consultant at [Orizens](http://orizens.com).\nMy services include:\n\n- consulting on how to approach code in projects and keep it maintainable.\n- I provide project bootstrapping and development - while afterwards, I integrate it on site and guide the team on it.\n\n[Contact Me Here](http://orizens.com/contact)\n\n## Installation\n\n```\nnpm install ngx-typeahead --save-dev\n```\n\n## Supported API\n\n### Inputs\n\n| Input                | Type                       | Required                   | Description                                                                                                                                                            |\n| -------------------- | -------------------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| taUrl                | string                     | YES                        | the url of a remote server that supports jsonp calls.                                                                                                                  |\n| taParams             | { key: string, value: any} | optional, default: {}      | a {key,value} (json) object to include as params for the json call. Each api supports different structure.                                                             |\n| taQueryParam         | query                      | optional, default: 'q'     | a string member which is set with the query value for search.                                                                                                          |\n| taCallbackParamValue | query                      | optional, NO Default       | a string value for the callback query parameter.                                                                                                                       |\n| taItemTpl            | TemplateRef                | - optional                 | a template reference to be used for each result item.                                                                                                                  |\n| taApi                | string                     | optional, default: 'jsonp' | the utility to make a request with - 'jsonp', 'http'.                                                                                                                  |\n| taApiMethod          | string                     | optional, default: 'get'   | the method to be used in either 'jsonp' or 'http'.                                                                                                                     |\n| taList               | any[]                      | optional                   | provide a static list of items to display. This prevents any remote request and has first precedence.                                                                  |\n| taListItemField      | string[]                   | optional                   | if item in static list is an object, this list of keys in the object that are checked when the list is filtered with the query. if list is empty, all keys are checked |\n| taListItemLabel      | string                     | optional                   | if static list of type object - this label is used as the key for displaying the item in the suggestions list - item[label]                                            |\n| taDebounce           | number                     | optional                   | set the debounce time before a request is called                                                                                                                       |\n| taAllowEmpty         | boolean                    | optional, default: false   | if true, it allows empty strings to pass and invoke search                                                                                                             |\n| taCaseSensitive      | boolean                    | optional, default: false   | if true, comparing query is performed with case sensitive                                                                                                              |\n| taDisplayOnFocus     | boolean                    | optional, default: false   | if true, will display results (if exist) when input is clicked                                                                                                         |\n\n### Outputs\n\n| Output     | Type   | Required | Description                               |\n| ---------- | ------ | -------- | ----------------------------------------- |\n| taSelected | string | YES      | emits an event once the item is selected. |\n\n## DEMO\n\n[Demo with all parameters StackBlitz](https://stackblitz.com/edit/ngx-typeahead?file=src/main.ts)\n\n## Usage\n\nApp/Component should be loaded as a standalone component:\n\n```typescript\nimport { bootstrapApplication } from '@angular/platform-browser';\nimport { AppComponent } from './app.component';\nimport { provideHttpClient, withJsonpSupport } from '@angular/common/http';\n\nbootstrapApplication(AppComponent, {\n  providers: [provideHttpClient(withJsonpSupport())],\n});\n```\n\nThen, in your component, add to `imports` array:\n\n```typescript\nimport { Component } from \"@angular/core\";\nimport { NgxTypeAheadComponent } from 'ngx-typeahead';\n\n@Component({\n  selector: \"app\",\n  template: `\n    \u003cdiv class=\"search-results\"\u003e\n      \u003cinput\n        [value]=\"search\"\n        ngxTypeahead\n        [taUrl]=\"url\"\n        [taParams]=\"params\"\n        (taSelected)=\"handleResultSelected($event)\"\n      /\u003e\n    \u003c/div\u003e\n  `,\n  imports: [NgxTypeAheadComponent]\n})\nexport class AppComponent {\n  url = \"http://suggestqueries.google.com/complete/search\";\n  params = {\n    hl: \"en\",\n    ds: \"yt\",\n    xhr: \"t\",\n    client: \"youtube\",\n    q: query,\n  };\n  search = \"\";\n\n  handleResultSelected(result) {\n    this.search = result;\n  }\n}\n```\n\n## Custom Template For Item\n\n```typescript\nimport { Component } from \"@angular/core\";\nimport { NgxTypeAheadComponent } from 'ngx-typeahead';\n\n@Component({\n  selector: \"app\",\n  template: `\n    \u003cdiv class=\"search-results\"\u003e\n      \u003cinput\n        [value]=\"search\"\n        ngxTypeahead\n        [taUrl]=\"url\"\n        [taParams]=\"params\"\n        [taItemTpl]=\"itemTpl\"\n        (taSelected)=\"handleResultSelected($event)\"\n      /\u003e\n      \u003cng-template #itemTpl let-result\u003e\n        \u003cstrong\u003eMY {{ result.result }}\u003c/strong\u003e\n      \u003c/ng-template\u003e\n    \u003c/div\u003e\n  `,\n  imports: [NgxTypeAheadComponent]\n})\nexport class AppComponent {\n  url = \"http://suggestqueries.google.com/complete/search\";\n  params = {\n    hl: \"en\",\n    ds: \"yt\",\n    xhr: \"t\",\n    client: \"youtube\",\n    q: query,\n  };\n  search = \"\";\n\n  handleResultSelected(result) {\n    this.search = result;\n  }\n}\n```\n\n# Showcase Examples\n\n- [Echoes Player - Developed with Angular, angular-cli and ngrx](http://orizens.github.io/echoes-player) ([github repo for echoes player](http://github.com/orizens/echoes-player))\n\n# NgxTypeahead\n\nThis library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.11.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forizens%2Fngx-typeahead","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forizens%2Fngx-typeahead","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forizens%2Fngx-typeahead/lists"}