You can trigger the 'onChange' event of your control by using the 'valueChanges' event of the form control, a method not deprecated. a Full tutorial is available at -
ValueChanges in Angular Forms[
^]
To do this, import the necessary classes in your component's TypeScript file -
import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
Now create a form control for your 'selectedCaptureInfo' field and subscribe to its 'valueChanges' observable -
export class YourComponent implements OnInit {
selectedCaptureInfoControl: FormControl;
ngOnInit() {
this.selectedCaptureInfoControl = new FormControl();
this.selectedCaptureInfoControl.valueChanges.subscribe(value => {
this.filter(value);
this.applyCaptureNameFilter(value);
});
}
}
Bind the 'selectedCaptureInfoControl' to the 'formControlName' in your HTML code -
<p-multiSelect id="capturesByFilter"
[options]="captures"
placeholder="Please Select"
optionLabel="name"
appendTo="body"
[filter]="true"
[formControl]="selectedCaptureInfoControl">
</p-multiSelect>