2016-07-13 6 views
0

ログイン機能を実装しようとしています。ionic2ナビゲーション付き角膜

Login.ts

import {Component} from "@angular/core"; 
    import {Header} from '../header/header'; 
    import {AuthenticationService, User} from '../../services/authService' 
    import {DetailsPage} from '../details/details'; 
    import {UserProfilePage} from '../userprofile/userprofile'; 
    import {NavController,NavParams} from 'ionic-angular'; 
    import {NgIf} from '@angular/common'; 




@Component({ 
    templateUrl: 'build/pages/login/login.html', 
    directives:[Header], 
    providers: [AuthenticationService], 
    styles:[' .login-home { align:center;margin-left:20px;}'] 
}) 

export class LoginPage { 

    public user = new User('',''); 
    public errorMsg = ''; 
    public pageHeader:string; 

    constructor(
     private _service:AuthenticationService,private nav: NavController) { 
      this.pageHeader="Login" 
      this.user = new User('',''); 
      this.nav = nav; 

     } 

    login() { 
     this.nav.setRoot(DetailsPage); 
     this.nav.push(DetailsPage); 
     // let loginSucessful = this._service.login(this.user) 
     /** if(loginSucessful !== undefined && loginSucessful == false){ 
       this.errorMsg = 'Invalid login'; 
      }*/ 
    } 

} 

詳細ページをフォロー

import {Component,OnInit} from "@angular/core"; 
import {Header} from '../header/header'; 
import {HomePage} from '../home/home'; 
import {AuthenticationService, User} from '../../services/authService' 
import {NavController,NavParams,Platform,Storage,SqlStorage,Toast} from 'ionic-angular'; 
import {NgIf} from '@angular/common'; 
import {PersonSO} from '../../services/personSO'; 



@Component({ 
    templateUrl: 'build/pages/userprofile/userprofile.html', 
    directives:[Header], 
    providers: [AuthenticationService] 
}) 
export class DetailsPage implements OnInit{ 
    public pageHeader:string; 
    public storage; 
    public people =[]; 



    constructor(private platform: Platform,private navParams: NavParams, 
     private _service:AuthenticationService,private nav: NavController) { 
      this.pageHeader="List of user"; 
       this.platform.ready().then(() => { 
       this.storage = new Storage(SqlStorage); 
       this.nav = nav;   
      }); 


     } 

    ngOnInit() {  
     this._service.checkCredentials(); 

    } 
    goBack(){ 
      this.nav.push(HomePage); 
    } 
    navigateToUserForm(){ 
      this.nav.push(HomePage); 
    } 

    edit(person:PersonSO){ 
     this.nav.push(HomePage,{ 
     person: person 
    }); 
    } 

} 

ようである私は、ホームページに詳細ページに行く場合、これは正常に動作しています。しかし、ログインページからナビゲートしています。私は以下のエラーを受けています

11 756293 error Uncaught EXCEPTION: Error in build/pages/login/login.html:17:20 ORIGINAL EXCEPTION: TypeError: Cannot read property 'parameters' of undefined ORIGINAL STACKTRACE: TypeError: Cannot read property 'parameters' of undefined at ReflectionCapabilities.parameters (http://localhost:8100/build/js/app.bundle.js:29733:40) at Reflector.parameters (http://localhost:8100/build/js/app.bundle.js:29921:48) at CompileMetadataResolver.getDependenciesMetadata (http://localhost:8100/build/js/app.bundle.js:11007:86) at CompileMetadataResolver.getTypeMetadata (http://localhost:8100/build/js/app.bundle.js:10958:26) at http://localhost:8100/build/js/app.bundle.js:11107:30 at Array.map (native) at CompileMetadataResolver.getProvidersMetadata (http://localhost:8100/build/js/app.bundle.js:11095:26) at CompileMetadataResolver.getDirectiveMetadata (http://localhost:8100/build/js/app.bundle.js:10910:34) at RuntimeCompiler.resolveComponent (http://localhost:8100/build/js/app.bundle.js:14802:47) at NavController.loadPage (http://localhost:8100/build/js/app.bundle.js:46890:24) ERROR CONTEXT:

解決策がある場合はお知らせください。 templateUrlビルドフォルダから呼び出すべきではありませんあなたの

答えて

0

かなり確信してここに

@Component({ 
    templateUrl: 'build/pages/login/login.html', 

エラーが発生しました。

@Component({ 
    templateUrl: 'login.html', 

次に、あなたのappフォルダ内app.module.tsファイルで定義する必要がどのようにイオンのイオンCLI

>_ ionic generate page login 

]ページを使用して、ビルドページ構造を見ることができます。

関連する問題