2016-07-27 3 views
0

私はそこにそれぞれのステップで子ルータを使用しているウィザードを持っているAureliaアプリケーションからルートが見つかりませんでした。ウィザードのためのAurelia Child Routerでのルーティングの問題

ユーザーはウィザードの途中で停止し、後でウィザードに戻る必要がある可能性があります。私は、現在のステップが何であれ、ユーザーをナビゲートすることができるようにしたい。私はdbの現在のステップを維持しています。

手順1でユーザーが開始し、各手順を進めることができるルーティングが機能しています。問題を解決する現在のステップに移動しようとするときです。参照目的のために

は、ここに私のメインのアプリルータの設定ここで

configureRouter(config, router) { 
    config.title = 'CoQC Builder'; 
    config.addAuthorizeStep(AuthorizeStep); 
    config.map([ 
        { route: ['', 'home'], name: 'home', auth:true, moduleId: 'home/home',  nav: true, title: 'Home', settings:{ icon:'fa fa-home',id:0,isHomePage:true, parentId:null,hasChildren:false,isTask:false,isDialogLink:false} }, 
        { route: 'home',   name: 'tasks', auth:true,  moduleId: 'home/home', nav: true, title: 'Tasks', settings:{icon:'fa fa-list',id:1,isHomePage:false, parentId:null,hasChildren:false,isTask:true,isDialogLink:false} }, 
        { route: 'home-fae',   name: 'faehome', auth:true,  moduleId: 'home/home-fae', nav: false, title: 'FAE Home', settings:{icon:'fa fa-list',id:12,isHomePage:true, parentId:null,hasChildren:false,isTask:true,isDialogLink:false} }, 
        { route: 'home-admin',   name: 'adminhome', auth:true,  moduleId: 'home/home-admin', nav: false, title: 'Admin Home', settings:{icon:'fa fa-list',id:13,isHomePage:true, parentId:null,hasChildren:false,isTask:true,isDialogLink:false} }, 
        { route: 'home-coqc',   name: 'coqchome', auth:true,  moduleId: 'home/home-coqc', nav: false, title: 'COQC Home', settings:{icon:'fa fa-list',id:14,isHomePage:true, parentId:null,hasChildren:false,isTask:true,isDialogLink:false} }, 
        { route: 'home-qa',   name: 'qahome', auth:true,  moduleId: 'home/home-qa', nav: false, title: 'QA Home', settings:{icon:'fa fa-list',id:15, parentId:null,isHomePage:true,hasChildren:false,isTask:true,isDialogLink:false} }, 
        { route: 'customer/:id', name: 'customer',auth:true, moduleId: 'customer/customer',href:"customer" ,nav: true, title: 'Customers', settings:{icon:'fa fa-users',id:2,parentId:null,hasChildren:true,isTask:false,isDialogLink:false} }, 
        { route: 'customer/search', name: 'mycustomers',auth:true, moduleId: 'Customer/customer', nav: true, title: 'Search Customers', settings:{icon:'fa fa-search',id:4,parentId:2,hasChildren:false,isTask:false,isDialogLink:false} }, 
        { route: 'customer/my', name: 'customers',auth:true, moduleId: 'customer/customer', nav: true, title: 'My Customers', settings:{icon:'fa fa-th-large',id:5,parentId:2,hasChildren:false,isTask:false,isDialogLink:true} }, 
        { route: 'coqc/search', name: 'coqc-search',auth:true, moduleId: 'search/search', nav: true, title: 'CoQC Search', settings:{icon:'fa fa-search',id:11, parentId:null,hasChildren:false,isTask:false,isDialogLink:false} }, 
        { route: 'gcoqclibrary', name: 'gcoqclibrary',auth:true, moduleId: 'gcoqclibrary', nav: true, title: 'gCoQC Library', settings:{icon:'fa fa-suitcase',id:6, parentId:null,hasChildren:false,isTask:false,isDialogLink:false} }, 
        { route: 'help', name: 'help', moduleId: 'help',auth:true, nav: true, title: 'Help/FAQ ', settings:{icon:'fa fa-question-circle',id:7, parentId:null,hasChildren:false,isTask:false,isDialogLink:false} }, 
        { route: 'feeds', name: 'feeds', moduleId: 'feeds',auth:true, nav: true, title: 'My Feeds', settings:{icon:'fa fa-feed',id:8, parentId:null,hasChildren:false,isTask:false,isDialogLink:false} }, 
        { route: 'user-profile', name: 'user-profile',auth:true, moduleId: 'user-profile', nav: true, title: 'User Profile', settings:{icon:'fa fa-user',id:9, parentId:null,hasChildren:false,isTask:false,isDialogLink:false} }, 
        { route: 'settings', name: 'settings',auth:true, moduleId: 'settings', nav: true, title: 'Settings', settings:{icon:'fa fa-cog',id:10, parentId:null,hasChildren:false,isTask:false,isDialogLink:false}} , 
        { route: 'coqc/wizard',auth:true, name: 'coqc-wizard', moduleId: 'wizard/wizard', nav: true, title: 'CoQC Wizard', settings:{icon:'fa fa-cog',id:10, parentId:null,hasChildren:false,isTask:false,isDialogLink:false} } 


    ]); 
    config.mapUnknownRoutes({ route: "id_token*token", moduleId: "home/home", nav: false, title: "home" }); 
    this.router = router; 
} 

は、子ルータの設定です:

configureRouter(config, router) { 
    config.title = 'wiz router'; 
    config.map( 
      { route: ["","/",":id/step1"],name:"wizard-step1",nav: true, moduleId: "./wizard-step1", href:"#/coqc-wizard/wizard-step1/",title: "Step 1: Format & Customer Selection", settings:{index:0, menu:"./wizard-step1-nav", step:1,formats:['PDF','EXCEL','XML','CSV',null], next:[{format:'PDF',index:1},{format:'Excel',index:1} ,{format:'XML',index:2},{format:'CSV',index:2}]}}, 
      { route: [":id/step2"],name:"wizard-step2", moduleId: "./wizard-step2", nav: true,href:"#/coqc-wizard/wizard-step2/", title: "Step 2: Format Setup", settings:{index:1, menu:"./wizard-step2-nav", step:2,formats:['PDF','EXCEL'],next:[{format:'PDF',index:2},{format:'Excel',index:2}],previous:[{format:'PDF',index:0},{format:'EXCEL',index:0}]} }, 
      { route: [":id/step3"],name:"wizard-step3", moduleId: "./wizard-step3", nav: true,href:"#/coqc-wizard/wizard-step3/", title: "Step 3", settings:{index:2, menu:"./wizard-step3-nav", step:3,formats:['PDF','EXCEL','XML','CSV'], next:[{format:'PDF',index:3},{format:'EXCEL',index:3} ,{format:'XML',index:3},{format:'CSV',index:3}],previous:[{format:'PDF',index:1},{format:'EXCEL',index:1} ,{format:'XML',index:0},{format:'CSV',index:0}]} }, 
      { route: [":id/step4"],name:"wizard-step4", moduleId: "./wizard-step4", nav: true,href:"#/coqc-wizard/wizard-step4/", title: "Step 4", settings:{index:3, menu:"./wizard-step4-nav", step:4,formats:['PDF','EXCEL','XML','CSV'], next:[{format:'PDF',index:1},{format:'EXCEL',index:1} ,{format:'XML',index:2},{format:'CSV',index:2}]} }, 
      { route: [":id/currentStep"],name:"wizard-nav", nav: false, moduleId: "./wizard-nav", title: "Wizard Nav"} 
    ); 
    this.router = router; 
} 

計画は、ユーザがナビゲートすることです:ID /進行中のウィザードがある場合はcurrentStepルート。

export class WizardNavigation{ 
constructor(templateService,parent){ 
    this.templateService = templateService; 
    this.parent = parent; 
} 

activate(params){ 
    ///Logic to determine what step user is on 
    let routename = "wizard-step3";//just an example 
    /// 
    this.parent.router.navigateToRoute(routename, {id:params.id}); 
} 

}

がthis.parent.router.navigateToRoute方法は取得:このルートは、その後、次のコードで正しいステップにユーザーをリダイレクトする現在のステップのためのデータベースを照会します実行して、私はそれがルートを見つけることができないと言ってaureliaルータからエラーを取得します。私はthis.parent.router.navigateメソッドを使ってバリエーションを試しました。私もパス全体を渡してみました(例: "#/ coqc/wizard/9/step2")。

私が間違っていると思われることについての助言やガイダンス、私が取る必要のある是正措置は評価されます。

ありがとうございます!

答えて

0

私は、正しいコードはこれです

に問題が...いくつかの最近の変更時には..私は偶然子ルータの設定から開閉ブラケットを取り外し見つかり:

config.map([ 
     { route: ["","/",":id/step1"],name:"wizard-step1",nav: true, moduleId: "./wizard-step1", href:"#/coqc-wizard/wizard-step1/",title: "Step 1: Format & Customer Selection", settings:{index:0, menu:"./wizard-step1-nav", step:1,formats:['PDF','EXCEL','XML','CSV',null], next:[{format:'PDF',index:1},{format:'Excel',index:1} ,{format:'XML',index:2},{format:'CSV',index:2}]}}, 
     { route: [":id/step2"],name:"wizard-step2", moduleId: "./wizard-step2", nav: true,href:"#/coqc-wizard/wizard-step2/", title: "Step 2: Format Setup", settings:{index:1, menu:"./wizard-step2-nav", step:2,formats:['PDF','EXCEL'],next:[{format:'PDF',index:2},{format:'Excel',index:2}],previous:[{format:'PDF',index:0},{format:'EXCEL',index:0}]} }, 
     { route: [":id/step3"],name:"wizard-step3", moduleId: "./wizard-step3", nav: true,href:"#/coqc-wizard/wizard-step3/", title: "Step 3", settings:{index:2, menu:"./wizard-step3-nav", step:3,formats:['PDF','EXCEL','XML','CSV'], next:[{format:'PDF',index:3},{format:'EXCEL',index:3} ,{format:'XML',index:3},{format:'CSV',index:3}],previous:[{format:'PDF',index:1},{format:'EXCEL',index:1} ,{format:'XML',index:0},{format:'CSV',index:0}]} }, 
     { route: [":id/step4"],name:"wizard-step4", moduleId: "./wizard-step4", nav: true,href:"#/coqc-wizard/wizard-step4/", title: "Step 4", settings:{index:3, menu:"./wizard-step4-nav", step:4,formats:['PDF','EXCEL','XML','CSV'], next:[{format:'PDF',index:1},{format:'EXCEL',index:1} ,{format:'XML',index:2},{format:'CSV',index:2}]} }, 
     { route: [":id/currentStep"],name:"wizard-nav", nav: false, moduleId: "./wizard-nav", title: "Wizard Nav"} 
]);