Reactive FormControl
element triggers ChangeDetection
whenever the input value is changed. I have added OnPush
strategy but still it runs ChangeDetection
,
@Component({
selector: 'app-server-input',
templateUrl: './server-input.component.html',
styleUrls: ['./server-input.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush
})
The FormControl
directive is the one that triggers ChangeDetection
. How do i stop running the ChangeDetection
when the input changes?
serverName: FormControl = new FormControl();
Here is my code on StackBlitz.
Note: One thing to note here is if you click on the button, the ngDocheck is called so I have used event manager to stop the change detection.