I am creating a typescript angular 2 application and using rxjs. I follow the example here:
https://angular.io/docs/ts/latest/tutorial/toh-pt6.html#!#stq=formgroup&stp=1
That's it, although I'm trying to hard-print my return signatures using typescript. This may be my problem in that you should not. But it looks like you should be able to.
Suppose I have a service that is dialed to return an Observable>.
public search(term: string) : Observable<Array<MyModel>> {
In my component, I am trying to listen to this observable stream and return results.
private search = new Subject<Search>();
results: Observable<Array<MyModel>>;
ngOnInit() {
this.results = this.search
.debounceTime(400)
.distinctUntilChanged()
.switchMap(search => {
return service.search(search.term);
});
}
This does not compile with the message Cannot convert type Observable<Object> to type Observable<MyModel[]>>
, switchmap Observable . , ? typescript ?