Mat*_*ieu 4 ionic-framework ionic3 angular
我不明白为什么我一次又一次地出现这个错误......当我有一个新的提供者时。当我有任何其他提供商(如地理定位等)时,出现此错误:
错误:未捕获的错误:NgModule 'AppModule' 的提供程序无效 - 仅允许提供程序和类型的实例,得到:[StatusBar, SplashScreen,?[object Object]?, ...]
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 { ImagePicker } from '@ionic-native/image-picker';
import { Crop } from '@ionic-native/crop';
import { AuthService } from '../pages/core/auth.service';
import { UserService } from '../pages/core/user.service';
import { FollowService } from "../pages/core/follow.service";
import { AngularFireModule } from 'angularfire2';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { environment } from '../environment/environment';
import { MyApp } from './app.component';
import { LoginPage } from '../pages/login/login';
import { RegisterPage } from '../pages/register/register';
import { WelcomePage } from '../pages/welcome/welcome';
import { HomePage } from '../pages/home/home';
@NgModule({
declarations: [
MyApp,
LoginPage,
RegisterPage,
WelcomePage,
HomePage,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
AngularFireModule.initializeApp(environment.firebase),
AngularFireAuthModule,
AngularFireDatabaseModule,
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
LoginPage,
RegisterPage,
WelcomePage,
HomePage,
],
providers: [
StatusBar,
SplashScreen,
ImagePicker,
Crop,
AuthService,
UserService,
FollowService,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)
Sha*_*pta 10
尝试添加/ngx到路径中,如下,在 Ionic 4 中:
import { File } from '@ionic-native/file/ngx';
Run Code Online (Sandbox Code Playgroud)
听起来您正在使用 Ionic 4 支持节点模块和 Ionic 3 应用程序。举个例子Geolocation.
如果你想@ionic-native/geolocation在 Ionic 3 应用程序中安装模块,你需要使用@4如下。
npm install @ionic-native/geolocation@4
Run Code Online (Sandbox Code Playgroud)
您需要为所有 Ionic3 提供程序执行此操作。
| 归档时间: |
|
| 查看次数: |
7409 次 |
| 最近记录: |