错误:无法解析 LoginPage 的所有参数:

我面临下一个错误,无法理解如何解决它。


错误:无法解析 LoginPage 的所有参数:([对象对象]、[对象对象]、[对象对象]、?)。


我已经检查了这里的几乎每个主题,并尝试了多种方法来解决它,但仍然无法在第二天击败它。Login.ts


import { Component } from '@angular/core';

import { IonicPage, NavController, NavParams,AlertController } from 'ionic-angular';   

import { AuthProvider } from '../../providers/auth/auth';

import { TabsPage } from '../tabs/tabs';



/**

* Generated class for the LoginPage page.

*

* See https://ionicframework.com/docs/components/#navigation for more info on

* Ionic pages and navigation.

*/


@IonicPage()

@Component({

selector: 'page-login',

templateUrl: 'login.html',

})

export class LoginPage {

email:string = '';

password:string = '';


errorMsg:string;


constructor(

public navParams: NavParams,

public navCtrl: NavController,


public alertCtrl: AlertController

public authService: AuthProvider,

) {

}

ionViewDidLoad() {

console.log('ionViewDidLoad LoginPage');

}


errorFunc(message){

let alert = this.alertCtrl.create({

  title: 'oops!',

  subTitle: message,

  buttons: ['OK']

});

alert.present();





myLogIn(){


if (this.email.trim() !==''    ) {


  console.log(this.email.trim() + "   " + this.password.trim() )


  if (this.password.trim()  === '') {

    this.errorFunc('Please put your password')


  }

  else{


    let credentials = {

      email: this.email,

        password: this.password

    };



     this.authService.login(credentials).then((result) => {

        console.log(result);

        this.navCtrl.setRoot(TabsPage);


    }, (err) => {

        console.log(err);

        this. errorFunc('Wrong credentials ! try again')

        console.log("credentials: "+JSON.stringify(credentials))


    });


  }

  }

  else{

  this. errorFunc('Please put a vaild password !  for ex:(123456)')

  }

  }

  myLogOut(){

  this.authService.logout();

  }

  }

Auth.ts


import { Injectable } from '@angular/core';

import { Storage } from '@ionic/storage';

 import { Http , Headers } from '@angular/http';

import { TabsPage } from '../../pages/tabs/tabs';


红颜莎娜
浏览 105回答 1
1回答

拉莫斯之舞

你似乎有一个经典的循环引用。您在两个和“”中都导入了“TabsPage”。Auth.tsLoginPage.ts经典的循环引用。尝试从 Auth.ts 中删除 TabsPage。通常,最好让组件执行非常具体的事情,以便获得粒度代码并避免此类循环引用问题。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript