Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular6 Property 'debounceTime' does not exist on type 'Observable<any>'?

Tags:

angular

rxjs

After updating my Angular 5 project into Angular 6 following Angular update guide i'm getting.

Property 'debounceTime' does not exist on type 'Observable<any>'

after running ng update my all components lost the debounceTime import. But i put it back manually but that didn't fixed the issue.

example.component.ts

import { debounceTime } from 'rxjs/operators';
 //Added after removed by ng update

 this.searchField.valueChanges
  .debounceTime(800)
  .distinctUntilChanged()
  .subscribe(term => {
    this.searchText = term;
    this.getAllDoctors();
  },

I really want to understand whats going on here.

like image 893
Ram Chandra Neupane Avatar asked Aug 19 '18 12:08

Ram Chandra Neupane


1 Answers

You need to use pipe operator.

this.searchField.valueChanges
  .pipe(debounceTime(800),
        distinctUntilChanged()
   )
  .subscribe(term => {
    this.searchText = term;
    this.getAllDoctors();
  }),
like image 193
Suresh Kumar Ariya Avatar answered Nov 11 '22 18:11

Suresh Kumar Ariya