orizens / ngx-typeahead

A simple but yet powerful typeahead component for Angular (css framework agnostic)
https://www.npmjs.com/package/ngx-typeahead
MIT License
61 stars 29 forks source link

How to handle http post request with ngx-typeahead? #52

Open fahadsubzwari924 opened 3 years ago

fahadsubzwari924 commented 3 years ago

All demos and examples of ngx-typahead are just using the same google search example or static json which is not usefull for most of the case.

I am implementing the same example of documentation like this component.html

<div class="search-results">
  <input
    [value]="search"
    ngxTypeahead
    [taUrl]="url"
    [taParams]="params"
    (taSelected)="handleResultSelected($event)"
  />
</div>`

component.ts

public url = "http://suggestqueries.google.com/complete/search";
  public params = {
   hl: "en",
   ds: "yt",
   xhr: "t",
   client: "youtube",
   q: query,
};

So can anyone make me understand that how this is working? how typed text term is passing to the api and how results showing in the template. And i have to call http post with a body so how can i do that? any example any guide?

orizens commented 3 years ago

hi @fahadsubzwari924 review https://github.com/orizens/ngx-typeahead#supported-api and try taApi and taApiMethod with taParams as the parameters object. look at the source code https://github.com/orizens/ngx-typeahead/blob/master/projects/ngx-typeahead/src/lib/ngx-typeahead.component.ts#L273

fahadsubzwari924 commented 3 years ago

Yes i saw these links. But i still didn't get that how searched/types keyword is passing into api to get search results? can you tell me that?

On Tue, 4 May 2021 at 01:40, Oren Farhi @.***> wrote:

hi @fahadsubzwari924 https://github.com/fahadsubzwari924 review https://github.com/orizens/ngx-typeahead#supported-api and try taApi and taApiMethod with taParams as the parameters object. look at the source code https://github.com/orizens/ngx-typeahead/blob/master/projects/ngx-typeahead/src/lib/ngx-typeahead.component.ts#L273

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/orizens/ngx-typeahead/issues/52#issuecomment-831519734, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGQGGBN6O7ZBRCGENBDVND3TL4C2VANCNFSM44BLSOAA .