gpt4 book ai didi

ionic-framework - 在模块 ts 中输入提供程序时出错

转载 作者:行者123 更新时间:2023-12-04 06:58:49 29 4
gpt4 key购买 nike

当我尝试在提供程序中import nativepagetransition 时,它显示错误。

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { LinkPage } from '../pages/link/link';
import { NativePageTransitions } from '@ionic-native/native-page-transitions';

import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';

@NgModule({
declarations: [
MyApp,
HomePage,
LinkPage,


],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
LinkPage

],
providers: [
StatusBar,
SplashScreen,
NativePageTransitions,


{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}

错误是,

Type ‘NativePageTransitionsOriginal’ is not assignable to type ‘Provider’.
Type ‘NativePageTransitionsOriginal’ is missing the following properties from type ‘FactoryProvider’: provide, useFactory [2322]]

最佳答案

ionic 4+ 中的所有 native 模块和服务 已移动到模块的 ngx 目录 .喜欢

在 ionic 3 中:

We were importing NativePageTransitions from @ionic-native/native-page-transitions
import { NativePageTransitions } from '@ionic-native/native-page-transitions';

现在在 ionic 4+ 中:

We have to import native modules from @ionic-native/module-name/ngx directory.
import { NativePageTransitions } from '@ionic-native/native-page-transitions/ngx';

关于ionic-framework - 在模块 ts 中输入提供程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54476479/

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