How to develop search suggestion text box using angular 2/4
How to develop search suggestion text box using angular 2/4
I'am new in Angular. How can i develop a drop down suggestion search box in angular 2/4. when clicking on search button the details are shown using below codes.But am trying while typing on text box the suggestion details need to show. same like Auto complete
My component.HTML
component.ts file Service.ts <form role="form">
Search
</div>
</div>
</form>
</div>
</section>
<section class="CommonsubWhiteBg" style='height:850px;overflow-y:scroll; overflow-x:hidden' (scroll)="onScroll($event)">
<ng-container *ngFor="let item of itemdetails;">
<article class="row" style="margin:0px;">
</article>
</ng-container>
<ng-container *ngIf="!itemdetails" style="margin:0px;">
<article class="col-md-12">
<h3>Loading data...</h3>
</article>
</ng-container>
<ng-container *ngIf="itemdetails&&itemdetails.length==0" class="ItemNotfoundArea row" style="margin:0px;">
<article class="col-md-12">
<h1>Sorry</h1>
<p>Item Not Found</p>
</article>
</ng-container>
</section>FetchItemDetailsSearch(itemcodeordesc: string): void {
this.pageIndex = 1;
this.searchflag = 1;
if (itemcodeordesc.length > 0)
this.searchcontent = itemcodeordesc;
else {
itemcodeordesc = undefined
this.searchcontent = itemcodeordesc;
}
this.prevScrollPosition = 0; this._enqService.FetchItemDetailsSearch(this.searchcontent,this.pageIndex).subscribe(itemsData => this.itemdetails = itemsData,
error => {
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
});
}FetchItemDetailsSearch(itemcodeordesc: string, pageIndex: number): Observable<IEnquiryDetails> {
return this._http.get('http://localhost:1234/api/enquirydetails/', { params: { itemcodeordesc: itemcodeordesc, pageIndex: pageIndex } })
.map((response: Response) => <IEnquiryDetails>response.json())
.catch(this.handleError)
}
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Comments
Post a Comment