You need to add the operator like this:
import 'rxjs/add/operator/toPromise';
This is needed for every rxjs operator you want to use.
More Related Contents:
- What is the correct way to share the result of an Angular Http network call in RxJs 5?
- What is the difference between Subject and BehaviorSubject?
- How do I create a singleton service in Angular 2?
- Angular2 – Interaction between components using a service
- How to call component method from service? (angular2)
- How to cancel/unsubscribe all pending HTTP requests in Angular 4+
- Pass config data using forRoot
- How to make a sequence of http requests in Angular 6 using RxJS
- Getting Image from API in Angular 4/5+?
- Angular subscribe elegant
- Best way to import Observable from rxjs
- TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable
- Behaviour subject initial value null?
- rxjs/Subject.d.ts error : Class ‘Subject’ incorrectly extends base class ‘Observable’
- Rxjs Retry with Delay function
- Subscribing to a nested Observable
- What is pipe for in RxJS?
- How to throw error from RxJS map operator (angular)
- How to return observable from subscribe
- How to return value inside subscribe Angular 4
- Do I need to `complete()` takeUntil Subject inside ngOnDestroy?
- How to pass results between chained observables
- Call child component method from parent class – Angular
- Angular 6: saving data to local storage
- Uncaught Error: Unexpected directive ‘MyComboBox’ imported by the module ‘AppModule’. Please add a @NgModule annotation
- Recording the web page by using Record RTC with Angular
- How to get rid of the warning .ts file is part of the TypeScript compilation but it’s unused
- How can I create an observable with a delay
- Angular 2 Observable with multiple subscribers
- Angular load external configuration before AppModule loads