我在Ionic中与this.nav.push
存在问题。我已经完成了登录/注册页面,但是当我登录时,我收到了此错误消息。我必须从login.ts添加代码,例如home.ts(这是主页)?Ionic未捕获(承诺):无效链接
Runtime Error
Uncaught (in promise): invalid link: HomePage
Error: Uncaught (in promise): invalid link: HomePage at d (http://localhost:8100/build/polyfills.js:3:3991) at l (http://localhost:8100/build/polyfills.js:3:3244) at Object.reject (http://localhost:8100/build/polyfills.js:3:2600) at NavControllerBase._fireError (http://localhost:8100/build/main.js:45465:16) at NavControllerBase._failed (http://localhost:8100/build/main.js:45453:14) at http://localhost:8100/build/main.js:45508:59 at t.invoke (http://localhost:8100/build/polyfills.js:3:11562) at Object.onInvoke (http://localhost:8100/build/main.js:4622:37) at t.invoke (http://localhost:8100/build/polyfills.js:3:11502) at n.run (http://localhost:8100/build/polyfills.js:3:6468) at http://localhost:8100/build/polyfills.js:3:3767 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:12256) at Object.onInvokeTask (http://localhost:8100/build/main.js:4613:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:12177) at n.runTask (http://localhost:8100/build/polyfills.js:3:7153)
@edit:当我想登录到我的应用程序出现问题。它是代码响应者 登录。
login.ts
public login() {
this.showLoading()
this.auth.login(this.registerCredentials).subscribe(allowed => {
if (allowed) {
this.nav.push('HomePage');
} else {
this.showError("Access Denied");
}
},
error => {
this.showError(error);
});
}
AUTH-service.ts(这里是执行我的腰部,并在那里我有通行证和电子邮件,我需要输入登录公共功能)
public login(credentials) {
if (credentials.email === null || credentials.password === null) {
return Observable.throw("Please insert credentials");
} else {
return Observable.create(observer => {
// At this point make a request to your backend to make a real check!
let access = (credentials.password === "pass" && credentials.email === "email");
this.currentUser = new User('Simon', '[email protected]');
observer.next(access);
observer.complete();
});
}
}
我不知道为什么这段代码是错误的。我的主页INY我的应用程序是home.ts和类是首页
欢迎来到StackOverflow!为了让我们更好地为您提供帮助,请更新您的问题,以便以[**最小,完整和可验证的示例**](http://stackoverflow.com/help/mcve)显示所有相关代码。如果您能让我们知道您迄今为止已经尝试解决您的问题,也会有所帮助。有关详细信息,请参阅有关[**如何提出良好问题**](http://stackoverflow.com/help/how-to-ask)的帮助文章,并参加该网站的[**游览**](http://stackoverflow.com/tour):) –