按照我开始的Angular更新指南(https://update.angular.io/)
$ ng update @angular/cli @angular/core
但这产生了一些不兼容的清单:
Package "codelyzer" has an incompatible peer dependency to "@angular/core" (requires ">=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0" (extended), would install "8.1.0").
Package "@ngrx/router-store" has an incompatible peer dependency to "@angular/router" (requires "^6.0.0" (extended), would install "8.1.0").
Package "ngrx-tslint-oftype" has an incompatible peer dependency to "typescript" (requires "^2.8.3", would install "3.4.5").
Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" (requires "6.1.3" (extended), would install "8.1.0").
Package "@angular/material" has an incompatible peer dependency to "@angular/core" (requires ">=6.0.0-beta.0 <7.0.0" (extended), would install "8.1.0").
Package "codelyzer" has an incompatible peer dependency to "@angular/compiler" (requires ">=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0" (extended), would install "8.1.0").
Package "@angular/material" has an incompatible peer dependency to "@angular/core" (requires ">=6.0.0-beta.0 <7.0.0" (extended), would install "8.1.0").
我更新了codelyzer
,将其从列表中删除。
然后,我想到可以更改命令以删除更多内容:
$ ng update @angular/cli @angular/core @ngrx/store @angular/material @angular/http
这给我留下了令人困惑的结果,令人困惑,因为仍然存在两个@angular/http
不兼容之一!
Package "ngrx-tslint-oftype" has an incompatible peer dependency to "typescript" (requires "^2.8.3", would install "3.4.5").
Package "@angular/http" has an incompatible peer dependency to "@angular/core" (requires "7.2.15", would install "8.1.0")
所以我有两个问题:
npm shrinkwrap
似乎有问题。请注意,我也尝试过ng update --all
,但这使我与其他与Angular升级无关的软件包不兼容。
我不愿意添加--force
;会更愿意能够解决问题,因此这不是必需的。有建议吗?
答案 0 :(得分:1)
id | lat | lon | observed | error
----+-----+-----+----------+-------
1 | 1 | 1 | 11 | -1
2 | 2 | 2 | 25 | -5
3 | 3 | 3 | 32 | -2
已被Angular弃用,不再使用(请参见here)。您可以改用@angular/http
(请参阅docs)。您将需要使用@angular/common/http
HttpClient
类
app.module.ts
HttpClientModule
您想使用它的任何地方
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
BrowserModule,
HttpClientModule
],
...
关于import { HttpClient } from '@angular/common/http';
class MyService() {
constructor(http: HttpClient) { }
...
的问题。尝试将您的打字稿版本升级到3。