[英]Navigation in Ionic 2 Not working
I have one login page and want to add a forgot password button, and when a user clicks it, he/she will redirect to the forgot password page . 我有一个登录页面,想添加一个“ 忘记密码”按钮,当用户单击它时,他/她将重定向到“ 忘记密码”页面 。
here is my login.html
这是我的
login.html
<button ion-button block color="blue"
(click)="goToSignup()"
class="signup-btn"
style="background:#45b64a;width:45%;margin:20px 2% 0;display:inline-block">
Signup</button>
<button ion-button block color="blue"
(click)="goToForgotPassword()"
class="signup-btn"
style="background:#45b64a;width:45%;margin:20px 2% 0;display:inline-block">
Forgot Password</button>
Here is my login.js
这是我的
login.js
..
..
import {
SignupPage
}
from '../signup/signup';
import {
ForgotPasswordPage
}
from '../forgotpassword/forgotpassword';
Page({
templateUrl: 'build/pages/loginpage/loginpage.html'
})
export class LoginPage {
static get parameters() {
return [[NavController], [Http]];
}
constructor(nav, http, fbProvider) {
this.login = {};
}
goToSignup() {
this.nav.push(SignupPage);
}
goToForgotPassword(){
this.nav.push(ForgotPasswordPage);
}
}
Here is my signup.js
这是我的
signup.js
..
..
Page({
templateUrl: 'build/pages/signup/signup.html'
})
export class SignupPage {
..
..
}
Here is my forgotpassword.js
这是我的
forgotpassword.js
..
..
Page({
templateUrl: 'build/pages/forgotpassword/forgotpassword.html'
})
export class ForgotPasswordPage{
..
..
}
Navigation for Signup is working perfectly, the only issue with is with the ForgotPassword Navigation. 注册导航功能运行正常,唯一的问题是ForgotPassword导航功能。
In the browser I am getting the error below. 在浏览器中,我得到下面的错误。
TypeError: self.context.goToForgotPassword is not a function at _View_LoginPage0._handle_click_36_0 (LoginPage.template.js:627:28)
TypeError:self.context.goToForgotPassword不是_View_LoginPage0._handle_click_36_0(LoginPage.template.js:627:28)上的函数
What is going wrong with forgotpassword
navigation? forgotpassword
导航出了什么问题?
Add your second page in app.module.., in declarations and in entrycomponents.. 在app.module ..,声明和entrycomponents中添加第二页。
for further details check this link 有关更多详细信息,请单击此链接
http://blog.ionic.io/10-minutes-with-ionic-2-adding-pages-and-navigation/ http://blog.ionic.io/10-minutes-with-ionic-2-adding-pages-and-navigation/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.