0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AngularでCan't resolve 'rxjs/add/operator/toPromise'と言われた時の対処法

Posted at

Angular8で学習をしていたらコンソールで「Can't resolve 'rxjs/add/operator/toPromise'」とエラーが出た。

import { Injectable, Inject } from '@angular/core';
import { GitSearch } from './git-search';
import { HttpClient } from '@angular/common/http';
import 'rxjs/add/operator/toPromise';

が、https://stackoverflow.com/questions/50552653/angular-6-module-not-found-error-regarding-rxjs/50552695
を参考すると、

toPromise method is now a permanent method of Observable.

とのことで以下の通り変更

import { Injectable, Inject } from '@angular/core';
import { GitSearch } from './git-search';
import { HttpClient } from '@angular/common/http';
import {Observable} from 'rxjs';

エラー解消しました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?