2017-10-12 5 views
0

Angular 2アプリを構築しています。

プロジェクトは、Visual Studio 2017を使用して開始され、私はできエリア(Home2017 /スタート/ Index.cshtml)内部のアプリに成功したルート:角度2 + MVCルーティング:フォールバック後にルーティングが失敗する

Route toHome2017 = null; 
    toHome2017 = routes.MapRoute(
       name: "Default_to_Home2017", 
       url: "{controller}/{action}/{id}", 
       defaults: new { controller = "Start", action = "Index", id = UrlParameter.Optional }, 
       namespaces: new string[] { "BIP2.Areas.Home2017.Controllers" } 
      ); 

      toHome2017.DataTokens["area"] = "Home2017"; 

角度ルーティングは次のとおりです。

/Architectureに移動すると、角度ルーティングが機能しています。しかし
、私はページを更新し、使用してHome2017 /スタート/インデックスにリダイレクト:角度のパスを、アプリケーションがロードされる

toHome2017 = routes.MapRoute(
      name: "Default_to_Architecture", 
      url: "Architecture", 
      defaults: new { controller = "Start", action = "Index", id = UrlParameter.Optional }, 
      namespaces: new string[] { "BIP2.Areas.Home2017.Controllers" } 
     ); 
      toHome2017.DataTokens["area"] = "Home2017"; 

が、:「」StartpageComponentとがURLで表示されます/建築/。

私には何が欠けていますか?



EDIT:同じ手法がわかりましAngularJS

答えて

0

で私のために働いていた、私はそれを見つけた:

は、ベースREFを設定し、ローカルホスト上のアプリケーションを実行する:

document.write('<base href="' + document.location.href + '" />'); 

は、ページをリフレッシュしたときにベースが/ Architectureになっていました。
は、単純にそれをChangeing:

<base href="/" /> 

は、それを解決しました。

関連する問題