如何在ionic 3中导入loadingController?

rr

我有一个在ionic 2上运行的应用程序,但是我将其升级到ionic 3,升级后,某些ionic插件无法正常工作,如LoadingController甚至是Platform一样。

生成错误“找不到名称'LoadingController'”。

我看了离子文件,现在不知道如何导入

按照我的代码:

import { LoadingController, Platform } from 'ionic-angular'

@Component({
 selector: 'app-root',
 templateUrl: './app.component.html',
 providers: [ ProfileService, AlertService ]
})

export class AppComponent {
  constructor(private router: Router, 
   public loadingCtrl: LoadingController,
   private activatedRoute: ActivatedRoute, 
   private loginService: LoginService, 
   private profileService: ProfileService,
   private _alertService: AlertService,
   private platform: Platform ) {
    router.events.subscribe((data) => {
      this.path = data.url.substr(1);
    })

    this.getUserName();
    this.platform.ready().then(() => {
      this.platform.registerBackButtonAction(() => {
        history.go(-1)
      });
   });  
 }}
爱迪生J

LoadingController Ionic 3 loadingController链接

home.html

    <ion-header>

  <ion-navbar>
    <ion-title>Loading</ion-title>
  </ion-navbar>

</ion-header>


<ion-content padding>

  <button ion-button (click)="loading()">Show Loading</button>

</ion-content>

home.ts

import { LoadingController } from 'ionic-angular';
export class LoadingPage {

  constructor(public navCtrl: NavController,public loadingCtrl: LoadingController) {
  }
  loading(){
    let load = this.loadingCtrl.create({
      content:'Please Wait....',
      duration: 3000
    });
    load.present();
  }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章