Add clear button in search box
This commit is contained in:
@@ -43,7 +43,21 @@
|
||||
</a>
|
||||
|
||||
<p-fluid>
|
||||
<input type="text" pInputText placeholder="Search title or author..." [(ngModel)]="bookTitle" (ngModelChange)="onBookTitleChange($event)"/>
|
||||
<div class="relative">
|
||||
<input type="text"
|
||||
pInputText
|
||||
placeholder="Search title or author..."
|
||||
[(ngModel)]="bookTitle"
|
||||
(ngModelChange)="onBookTitleChange($event)"/>
|
||||
<p-button *ngIf="bookTitle"
|
||||
icon="pi pi-times"
|
||||
[text]="true"
|
||||
size="small"
|
||||
[rounded]="true"
|
||||
class="absolute right-2 top-1/2 transform -translate-y-1/2"
|
||||
(click)="clearSearch()">
|
||||
</p-button>
|
||||
</div>
|
||||
</p-fluid>
|
||||
|
||||
<p-select
|
||||
|
||||
@@ -354,6 +354,11 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
this.bookOrAuthor$.next(newTitle);
|
||||
}
|
||||
|
||||
clearSearch(): void {
|
||||
this.bookTitle = '';
|
||||
this.onBookTitleChange('');
|
||||
}
|
||||
|
||||
openShelfAssigner() {
|
||||
this.dynamicDialogRef = this.dialogService.open(ShelfAssignerComponent, {
|
||||
header: `Update Books' Shelves`,
|
||||
|
||||
Reference in New Issue
Block a user