gpt4 book ai didi

angular - 如何在 ionic 3 中使用 Angular 6?

转载 作者:太空狗 更新时间:2023-10-29 17:14:30 25 4
gpt4 key购买 nike

我在 Angular 5.2 上有一个 Ionic 3 应用程序。我正在尝试更新到 Angular 6。我已经按照 HttpClientNgModule 的升级指南进行操作。我现在遇到的问题是 ionic-native

我安装了 ionic-native V5,它正在使用 rxjs v6(angular6 需要并且与以前的版本不兼容)。

这是我的app.module.ts 文件

import { Device } from '@ionic-native/device/ngx';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'
import { BrowserModule } from '@angular/platform-browser'
import { HttpClientModule } from '@angular/common/http'

@NgModule({
declarations: [
MyApp,
],
imports: [
BrowserModule,
HttpClientModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot(),
],
bootstrap: [IonicApp],
entryComponents: [
MyApp
],
providers: [
Device
]
})
export class AppModule { }

我遇到了多个错误

Cannot find name 'Device'

Argument of type '{ declarations: (typeof MyApp)[]; imports: (ModuleWithProviders | typeof HttpClientModule | typeo...' is not assignable to parameter of type 'NgModule'. Types of property 'providers' are incompatible. Type '(DeviceOriginal ' is not assignable to type 'Provider[]'. Type 'DeviceOriginal' is not assignable to type 'Provider'. Type 'DeviceOriginal' is not assignable to type 'Provider'. Type 'DeviceOriginal' is not assignable to type 'ClassProvider'. Property 'provide' is missing in type 'DeviceOriginal'.

问题是:ionic 3 可以与 angular 6 一起使用吗?

最佳答案

到目前为止,唯一对我有用的是将 ionic-native 保持在 4.10.0 版本并安装 rxjs-compat

我认为现在进一步行动还为时过早。这是 package.json

"dependencies": {
"@angular/common": ">=6.0.9",
"@angular/compiler": ">=6.0.9",
"@angular/compiler-cli": ">=6.0.9",
"@angular/core": ">=6.0.9",
"@angular/forms": ">=6.0.9",
"@angular/http": ">=6.0.9",
"@angular/platform-browser": ">=6.0.9",
"@angular/platform-browser-dynamic": ">=6.0.9",
"@angular/pwa": ">=0.6.8",
"@angular/service-worker": ">=6.0.9",
"@ionic-native/core": ">=4.10.0",
"ionic-angular": ">=3.9.2",
"purify-css": ">=1.2.5",
"rxjs": "^6.2.2",
"rxjs-compat": ">=6.2.2",
"zone.js": ">=0.8.26"
}

关于angular - 如何在 ionic 3 中使用 Angular 6?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50664936/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com