I have an existing Angular 2 project that I ported to Angular 6 and now my HTTP-observable is not running any longer. As far I read it is about different operations of the new observable.
My service returns an observable. This I subscribe in the component and set interval and startindex.
How can I do that in Angular 6?
// SERVICE
@Injectable ()
export class ViewService
{
constructor (private http : HttpClient)
{ }
foo () : Observable <any>
{
return this.http.get ("http://blabla",
{responseType: "json"});
}
}
// COMPONENT
export class ViewComponent
{
constructor (private vs : ViewService)
{ }
ngOnInit ()
{
this.vs.foo ().interval (1000).startWith (0).subscribe (
(resp) =>
{
});
}
}
Error
Error: error TS2339: Property 'interval' does not exist on type 'Observable'
Using rxjs 6.0.0