Reputation: 2415
i'm using Behavior Subject in a angular 2 component and i want the second emitted value before last one , RxJs document says i should use skipLast method on my stream to ignore them but i get an error while using it that says :
Property 'skipLast' does not exist on type 'Observable'
Angular version : 2.3.1 Rx.js version : 5.0.3
here is my code :
import 'rxjs'
import { BehaviorSubject } from 'rxjs/BehaviorSubject'
@Component({
...
})
export class FilesComponent {
folderId: BehaviorSubject<number> = new BehaviorSubject(0)
constructor() {
this.folderId.skipLast(2).subscribe(
value => { console.log(value) }
)
}
clickHandler(fileId: number): void {
this.folderId.next(fileId)
}
}
Upvotes: 2
Views: 717
Reputation: 2415
skip last operator is now added to RxJS 5 https://github.com/ReactiveX/rxjs/pull/2316
Upvotes: 3
Reputation: 657741
Add
import 'rxjs/add/operator/skipLast'
Actually, there is no skipLast
operator.
https://github.com/ReactiveX/rxjs/blob/eb462bf8836d1bc27db5d11a9ea7cb4fa4b90f19/MIGRATION.md
skipLast | No longer implemented
Upvotes: 2