2017-02-15 53 views
0

我想angularjs路由在我的MVC應用程序整合......在這一刻我已經寫了沒有關於角路由代碼...我剛纔添加的標籤當我添加基礎標籤MVC路由的推移循環

<base href="/" /> 

而我運行我的MVC應用程序...它已停止工作。

在這裏,我是如何配置我的MVC的路由:

public static void RegisterRoutes(RouteCollection routes) 
{ 
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 

    routes.MapRoute(
     name: "Default", 
     url: "{controller}/{action}/{id}", 
     defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
    ); 
} 

我也一個Services區和路由配置INT是這樣的:

public override void RegisterArea(AreaRegistrationContext context) 
{ 
    context.MapRoute(
     "Services_default", 
     "Servizi/{controller}/{action}/{id}", 
     new { action = "Index", id = UrlParameter.Optional } 
    ); 
} 

,當我瀏覽一個網址在該地區,應用程序在循環中。

例如,當我瀏覽/Servizi/Cpe,調試汽車無停在了Index行動CpeController的:

public class CpeController : Controller 
{ 
    // GET: Services/Cpe 
    public ActionResult Index() 
    { 
     return View(); 
    } 
} 

這是結果:

enter image description here

這就像頁面不止一次顯示。

爲什麼?你能幫我嗎?

回答

0

我已經解決了......問題是,在頁面中我有一個jQuery的選項卡...所以我有一些href設置爲#

<div ......> 
    <ul> 
     <li><a href="#tab-models">Modelli</a></li> 
     <li><a href="#tab-info">Info</a></li> 
    </ul> 

    <div id="tab-models"> 
     ... 
    </div> 

    <div id="tab-info"> 
     ... 
    </div> 
</div> 

當基礎標籤是那些HREF創造一些問題組。在我短暫的經歷中,我瞭解到jQuery和angular經常不能很好地工作。 所以我最喜歡移動到角材料。我用角材選項卡替換了jQuery選項卡:

<div id="cpes" class="tabs" ng-cloak> 
    <md-content> 
     <md-tabs md-dynamic-height md-no-pagination> 
      <md-tab label="Modelli"> 
       <md-content> 
        ... 
       </md-content> 
      </md-tab> 
      <md-tab label="Info"> 
       <md-content> 
        ... 
       </md-content> 
      </md-tab> 
     </md-tabs> 
    </md-content> 
</div>