Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
207 views
in Technique[技术] by (71.8m points)

css - How to show progress in a search input using angular material?

I created an application which contains material input for search purpose. I would like the horizontal line of the input field to have progress indicator, when search is in progress. My idea is to show and hide progressBar with *ngIf and move it with css to match te input horizontal line height. Here is the code:

<mat-form-field>
   <mat-label>Search</mat-label>
   <input matInput (input)="onSearchChange($event.target.value)">
   <mat-progress-bar *ngIf="searchDone" style="top:9px" [color]='color' mode="query"></mat-progress-bar>
</mat-form-field>

I dont think it is the best solution, because I see the input horizontal line under the progressbar. Is there any solution that makes the input horizontal line to show progress by itself?

question from:https://stackoverflow.com/questions/65901359/how-to-show-progress-in-a-search-input-using-angular-material

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As one possible solution you can start using the lib NgxMatSelectSearch.

The Api has an input option searching to display an indicator while searching.

See the example Stackblitz and try to search in "Server side search" input.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...