Reputation: 1474
I'm trying to use throttleTime operator on a subject. I have imported the operator. I'm getting this error: this.cropSubject.asObservable(...).throttleTime is not a function
. I can't figure out what is going wrong. Is this a bug?
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { throttleTime } from 'rxjs/operator/throttleTime';
export class EditItemComponent implements OnInit, AfterViewInit{
cropSubject: Subject<string> = new Subject<string>();
constructor(private taggingDataService: TaggingDataService, private _elementRef : ElementRef) {
taggingDataService.selectedTags.subscribe((newTags) => {
this.selectedTags = newTags;
})
this.cropSubject.asObservable().throttleTime(1000).subscribe((croppedImageSrc) => {
this.updateImageData(croppedImageSrc);
})
}
Upvotes: 3
Views: 1398
Reputation: 108491
You want to add the operator. You're just importing the implementation.
import 'rxjs/add/operator/throttleTime';
It will add the throttleTime
operator to the prototype.
Upvotes: 1