Try it,
<div class="example-container mat-elevation-z8"> <div class="example-header"> <mat-form-field> <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter"> <mat-icon matPrefix>search</mat-icon> </mat-form-field> </div> </div>
Just included matPrefix in mat-icon.
Hope this solves the problem.
source share