Ionic 3错误没有AppVersion的提供者

时间:2017-05-19 10:16:53

标签: ionic-framework ionic2

我正在使用Ionic 3(延迟加载):

我收到此错误,但似乎无法找到我的方式错误。

  

错误:没有AppVersion的提供商!

我有:

settings.module.ts

import { AppVersion } from '@ionic-native/app-version';

constructor( public appVersion: AppVersion)

settings.ts

for (var x = 0; x < text.length; x++)
{
    var c = str.charAt(x);
    //Add code here to do the translation
}

1 个答案:

答案 0 :(得分:2)

需要将AppVersion添加到settings.module.ts

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { SettingsPage } from './settings';
import { AppVersion } from '@ionic-native/app-version';

@NgModule({
  declarations: [SettingsPage],
  imports: [IonicPageModule.forChild(SettingsPage)],
  providers: [AppVersion]
})
export class SettingsPageModule { }