I am receiving an error when trying to build my application using angular 6 and have no idea what to do.
Module rxjs not found see this
Module not found ..Cannot resolve module 'rxjs/operators/toPromise
what should i do ?
// the contact.service.ts
import { Injectable } from '@angular/core';
import { Contact } from './contact';
import { Http, Response } from '@angular/http';
import 'rxjs/add/operator/toPromise';
@Injectable()
export class ContactService {
private contactsUrl = '/api/contacts';
constructor (private http: Http) {}
.......
}
From rxjs 6 onwards toPromise is not an operator, it is part of observable object, you should be able to access directly without any imports
try to remove the import statement. It should work without that. Below code works.
From rxjs 5.5, "toPromise: now exists as a permanent method on Observable"
https://github.com/ReactiveX/rxjs/blob/master/CHANGELOG.md