The Searchbar's disable attribute does not affect the inner input
element. One potential solution could involve manipulating the DOM using ViewChild or ViewChildren...
Alternatively, Ganesh Pediredla's approach suggests implementing a method to enable/disable the component based on the pointer-events
CSS property.
To achieve this, create a property that toggles a CSS class with the declaration pointer-events: none;
HTML
<ion-searchbar [ngClass]="{ 'no-pointer-events': disableSearchbar }" class="add-place-item-divider" [(ngModel)]="mainTrail.source"></ion-searchbar>
CSS
.no-pointer-events {
pointer-events: none;
}
Component
public disableSearchbar: boolean = true;
toggleSearchbar(status: boolean): void {
this.disableSearchbar = !this.disableSearchbar;
}
Check it out in action on stackblitz