Property 'filter' does not exist on type 'Observable'

后端 未结 7 1525
盖世英雄少女心
盖世英雄少女心 2021-01-31 13:38

Hi I am using Angular 2 final with router 3.0. I want to filter the events that are emitted from this.router.events

What I want to do :



        
7条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 14:06

    After updating to Rxjs 6 with Angular 6 upgrade.

    import { map, filter, scan } from 'rxjs/operators';
    
    ...
    this.registrationForm.valueChanges
          .pipe(
            filter(() => this.registrationForm.valid),
            map((registrationForm: any) => {
              this.registrationVm.username = registrationForm.username;
              this.registrationVm.password = registrationForm.password;
              this.registrationVm.passwordConfirm = registrationForm.passwordConfirm;
            })
          )
          .subscribe();
    

提交回复
热议问题