I have a form control that I am customizing in my template using mat-option. However, I want this specific customization to not trigger "valueChanges", as I have other changes that should call the "valueChanges" function.
Here is the setup in my component:
inputControl = new FormControl('');
ngOnInit() {
this.inputControl.valueChanges
.pipe(takeUntil(this.onDestroy))
.subscribe(val => {
//do something
});
}
In the HTML:
<ng-container *ngIf="inputControl.value as val">
<mat-option *ngFor="let result of autocompleteResults; let i = index" [value]="result.displayName"
(onSelectionChange)="searchByResult($event, result)">
{{result.displayName}}
</mat-option>
</ng-container>
Is there any way to achieve the desired outcome without triggering "valueChanges" for this specific change?