1
我試圖開發使用角2應用程序與離子2和替代NavController我想嘗試用UI的路由器NG2路由。無法解決所有參數的StateService
Login.ts:
import { Component } from '@angular/core';
import { NavController, MenuController } from 'ionic-angular';
import { AlertController } from 'ionic-angular';
import { StateService } from "ui-router-ng2";
import { DashboardPage } from '../dashboard/dashboard';
@Component({
selector: 'page-login',
templateUrl: 'login.html',
providers: [StateService]
})
export class LoginPage {
username: string;
password: string;
constructor(public navCtrl: NavController, public menu: MenuController, public alertCtrl: AlertController, public state: StateService) {
this.menu.enable(false, 'sidenav')
}
login() {
if (this.username == "admin" && this.password == "admin") {
// this.navCtrl.setRoot(DashboardPage, { username: this.username });
this.state.go(DashboardPage);
} else {
let alert = this.alertCtrl.create({
title: 'Incorrect Credentials!',
subTitle: 'Your username and password are incorrect. Hint: admin',
buttons: ['Login Again']
});
alert.present();
}
}
}
我已經進口的StateService從 「UI-路由器NG2」。 I got the error, Can't resolve all parameters for StateService:
請幫我分揀這個問題。
你有'UIRouterModule.forRoot()'在你的bootstrap? –
任何人已經解決了這個問題呢? – Rezoan