Angular 6 upgrade: debounceTime is not property of Subject

前端 未结 4 1645
旧时难觅i
旧时难觅i 2021-02-19 08:06

I am attempting to upgrade my app from Angular 5 to Angular 6. I followed the steps on the https://update.angular.io/ At least i think i did.

The Error is :

<         


        
4条回答
  •  一向
    一向 (楼主)
    2021-02-19 08:31

    As of Angular 6.1.8, just need to import and add pipe like below example

    import {debounceTime} from 'rxjs/operators';

    Then on field just before the observable subscribe method call pipe(debounceTime(1000)) like below:

    emailControl.valueChanges.pipe(debounceTime(1000)).subscribe(value => this.setMessage(emailControl));

    And that's it, it's just a updated answers of @tiago's answer - where she is defining const debouncetime - we don't really need to use const and pipe.

提交回复
热议问题