Last active
November 2, 2019 20:42
-
-
Save jrodl3r/5f39943cac532f297242cdef52e0eb9b to your computer and use it in GitHub Desktop.
ElasticSearch - Angular Search Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="searchbox"> | |
<input | |
#searchInput | |
type="text" | |
placeholder="Find a Person or Contact" | |
(keyup)="updateSearch.next($event)" | |
(focus)="showResults()"> | |
<i | |
class="search-icon fa fa-search" | |
(click)="focusInput()" | |
*ngIf="!query"></i> | |
<span | |
class="clear-icon" | |
(click)="clearResults()" | |
*ngIf="query">×</span> | |
<ul | |
class="results" | |
*ngIf="search.results && search.results.length && resultsVisible"> | |
<li *ngFor="let contact of search.results"> | |
<a [routerLink]="'/contact/' + contact.id"> | |
<i class="fa fa-id-card"></i> | |
<span> | |
<strong [innerHTML]="highlightResults(contact.company ? contact.company : contact.name)"></strong><br> | |
<span [innerHTML]="highlightResults(contact.company ? contact.name : contact.title)"></span> | |
</span> | |
</a> | |
</li> | |
</ul> | |
<div | |
class="no-results" | |
*ngIf="query && search.results && !search.results.length && !search.isFetching"> | |
No results found matching <strong>{{ query }}</strong>. | |
</div> | |
<div | |
class="loading" | |
[class.disabled]="!search.isFetching"> | |
<app-loading-spinner></app-loading-spinner> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment