我有一个问题,我似乎无法弄明白。我的MVC角度应用程序突然开始循环播放fiddler重复下载所有脚本文件。
我可以通过删除我的最新添加内容来阻止它,但我无法看到我的新角度js文件有什么问题。
以下是来自Fiddler的样本:
/Scripts/kendo/2015.3.1111/kendo.aspnetmvc.min.js?_=1453249603004
/Scripts/kendo.modernizr.custom.js?_=1453249603005
/Scripts/bootstrap/3.3.6/bootstrap.min.js?_=1453249603006
/Angular/js/app-MainNav.js?_=1453249603007
/Angular/js/app-SubNav.js?_=1453249603008
/Scripts/jquery-2.2.0.min.js?_=1453249603010
/Scripts/Angular/1.4.8/angular.min.js?_=1453249603011
/Scripts/Angular/1.4.8/angular-route.min.js?_=1453249603012
/Scripts/kendo/2015.3.1111/jquery.min.js?_=1453249603013
/Scripts/kendo/2015.3.1111/jszip.min.js?_=1453249603014
/Scripts/kendo/2015.3.1111/kendo.all.min.js?_=1453249603015
/Scripts/kendo/2015.3.1111/kendo.aspnetmvc.min.js?_=1453249603016
/Scripts/kendo.modernizr.custom.js?_=1453249603017
/Scripts/bootstrap/3.3.6/bootstrap.min.js?_=1453249603018
/Angular/js/app-MainNav.js?_=1453249603019
/Angular/js/app-SubNav.js?_=1453249603020
/Scripts/jquery-2.2.0.min.js?_=1453249603022
/Scripts/Angular/1.4.8/angular.min.js?_=1453249603023
/Scripts/Angular/1.4.8/angular-route.min.js?_=1453249603024
/Scripts/kendo/2015.3.1111/jquery.min.js?_=1453249603025
/Scripts/kendo/2015.3.1111/jszip.min.js?_=1453249603026
/Scripts/kendo/2015.3.1111/kendo.all.min.js?_=1453249603027
/Scripts/kendo/2015.3.1111/kendo.aspnetmvc.min.js?_=1453249603028
/Scripts/kendo.modernizr.custom.js?_=1453249603029
/Scripts/bootstrap/3.3.6/bootstrap.min.js?_=1453249603030
/Angular/js/app-MainNav.js?_=1453249603031
/Angular/js/app-SubNav.js?_=1453249603032
/Scripts/jquery-2.2.0.min.js?_=1453249603034
/Scripts/Angular/1.4.8/angular.min.js?_=1453249603035
/Scripts/Angular/1.4.8/angular-route.min.js?_=1453249603036
/Scripts/kendo/2015.3.1111/jquery.min.js?_=1453249603037
/Scripts/kendo/2015.3.1111/jszip.min.js?_=1453249603038
/Scripts/kendo/2015.3.1111/kendo.all.min.js?_=1453249603039
新的角度js文件:
(function ()
{
"use-strict";
angular.module("appMainNav", [])
.directive("dashboardMainNav", function () {
return {
restrict: "E",
templateUrl: "/Navigation/GetDashItems"
}
});
})();
我的自定义指令:
<div class="row">
<div ng-app="appMainNav" class="col-md-2">
<dashboard-main-nav></dashboard-main-nav>
</div>
</div>
根据小提琴手,它确实称之为路线,但我从来没有打过断点。 角度js文件被添加到_Layout页面。
修改
GetDashItems是一个MVC路由,它将我带到这个控制器:
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult GetDashItems()
{
....snip.....
return PartialView("~/Views/Navigation/_MainNav.cshtml", model);
}
cshtml是: (我曾经有@_Layout但是删除了它认为导致循环但它没有区别)
@model DashboardModel
<nav id="mymlsNavbar" role="navigation">
<div>
@(Html.Kendo().PanelBar()
.Name("pnlbr_DashNav")
.ExpandMode(PanelBarExpandMode.Single)
.HtmlAttributes(new { style = "width:200px" })
.Items(panelbar =>
{
foreach (var dashitm in Model.DashNavigation)
{
panelbar.Add()
.Expanded(true)
.Text(dashitm.Name)
.Items(subpnl =>
{
foreach (var subitm in dashitm.SubDashNav)
{
subpnl.Add()
.Text(subitm.Name)
.Enabled(!subitm.IsAdvanced)
.url(subitm.Route)
.Route(subitm.Route);
}
});
}
})
)
</div>
</nav>
编辑2。
好的这很奇怪......我想知道这是否是VS 2015的错误。我在调试器中启动它,然后得到脚本循环。我立即杀了它。重新启动它,没有循环,一切正常????
我将尝试在VS2013中查看它是否表现相同。同时将其发布到开发服务器并查看其行为。