Currently, I'm studying the Angular 5 HTTP tutorial. Everything was going smoothly until I encountered a strange issue in my Ionic project where it started throwing an error stating that "of is not defined".
/**
* Handle Http operation that failed.
* Let the app continue.
* @param operation - name of the operation that failed
* @param result - optional value to return as the observable result
*/
private handleError<T> (operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
// TODO: send the error to remote logging infrastructure
console.error(error); // log to console instead
// TODO: better job of transforming error for user consumption
this.log(`${operation} failed: ${error.message}`);
// Let the app keep running by returning an empty result.
return of(result as T);
};
}
I tried searching for information on this "of" method, but unfortunately had no luck. Could this be an error in the tutorial or maybe a missing library?