2016-05-03 13 views
0

Plunkerの私のコードを参照してください:https://plnkr.co/edit/knuf4Z64Kla2vPQRociv?p=infoルーティング、動的URLで作業していない

私は、動的URLを扱うルーティング一部を取得しようとしています。

私Component.js(メタデータのみ、完全なコードはplnkr.coである)

sap.ui.core.UIComponent.extend("com.myapp.Component", { 
    metadata: { 
     rootView: "myapp.main", 
     routing: { 
      config: { 
       routerClass: "sap.m.routing.Router", 
       viewType: "JS", 
       viewPath: "myapp", 
       controlId: "mainapp", 
       controlAggregation: "pages", 
       transition: "slide" 
      }, 
      routes: [{ 
       pattern: "main", 
       name: "main", 
       target: "main" 
      }, { 
       pattern: "agent", 
       name: "agent", 
       target: "agent" 
      }], 
      targets: { 
       main: { 
        viewName: "main", 
        viewLevel: 1 
       }, 
       agent: { 
        viewName: "agent", 
        viewLevel: 2 
       } 
      } 
     } 
    } 
}); 

答えて

0

このチェック:あなたはあなたの設定でrouterClassを指定する必要がhttps://sapui5.hana.ondemand.com/sdk/#docs/guide/cf3c57c89ef0491793d1ce327ab4f9b2.html

。あなたのシナリオではおそらくルーターがundefinedであるのです。

さらに、ルーティング設定でrootViewcontrolIdcontrolAggregationを指定する必要があります。

+0

こんにちは@cschuff、私の更新された質問に関してもっと説明してください。ありがとうございます –

+0

新しいrootViewを作成し、そこにAppコントロールを置き、Component.jsからcreateContentを削除できますか? createContentとaddPAgesがルーティングと一緒にうまく動作するかどうかは完全にはわかりません... – cschuff

関連する問題