Angular 6 upgrade: debounceTime is not property of Subject

前端 未结 4 1660
旧时难觅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:46

    i am sorry for the delay but i just get this problem today and fixed like this. i solve this issue like this: first import like this:

    import {debounceTime} from 'rxjs/operators';
    import {pipe} from 'rxjs'
    

    Then create a const like this (i tried to do directly without duplicating pipe but didn´t work so i found this solution):

    const debouncetime = pipe(debounceTime(1000));
    

    And then use it before you subscribe for example i was doing an email validator with messages:

    const emailControl = this.registerForm.get('email');
        emailControl.valueChanges
         .pipe(debouncetime)
         .subscribe(value => this.setEmailMessage(emailControl))
    

    dont know if its the best solutions but it works perfectly. I hope it helps some one!

提交回复
热议问题