I'm new to Angular and while doing development the below code will not work (I'm using Visual Studio Code as the code editor)
post.service.ts file
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import  'rxjs/add/operator/catch';
import { AppError } from 'src/common/app-error';
@Injectable({
  providedIn: 'root'
})
export class PostService {
  private url = 'https://jsonplaceholder.typicode.com/posts';
  constructor(private http: Http) {
  }
deletePost(id) {
    return  this.http.delete(this.url + '/' + id)
    .catch((error:Response) => {
      Observable.throw(new AppError(error));
     });
  }
}
app-error.ts file
export class AppError {
    constructor(public originalError?: any) { }
}
3 errors are there
- Property 'catch' does not exist on type 'Observable'
- Cannot find module 'rxjs-compat/Observable'
- Module '"/node_modules/rxjs/Observable"' has no exported member 'Observable'
I expect for a solutions from all experts
