在我的MVC4应用程序中使用angularjs工作正常并且没有错误。如果我使用
捆绑js和cssBundleTable.EnableOptimizations = true;
我没有发现错误。 http://errors.angularjs.org/1.3.15/ $注射器/ modulerrδP0
Controller.js
App.controller('userController',
['$rootScope', '$scope', '$state', 'exDialog', '$stateParams', 'toaster', 'Upload', '$modal',
function ($rootScope, $scope, $state, exDialog, $stateParams, toaster, Upload, $modal) {
//Logic here
}]);
解决方案
问题是我们在缩小时的问题。使用单个字符更改指令名称以进行缩小。发布Js查找方法
public class NonMinifying : IBundleTransform
{
public void Process(BundleContext context, BundleResponse bundle)
{
if (bundle == null)
{
throw new ArgumentNullException("bundle");
}
//context.HttpContext.Response.Cache.SetLastModifiedFromFileDependencies();
foreach (var file in bundle.Files)
{
HttpContext.Current.Response.AddFileDependency(HttpContext.Current.Request.MapPath(file.IncludedVirtualPath));
}
}
}
像下面的代码一样创建包并将你的js逐个捆绑到this.if工作正常改变下一个js 像这样我找到了问题。希望上面的细节将有助于在js中找到问题行
bundles.Add(new Bundle("~/bundles/appScriptsnonmini", new NonMinifying())
.IncludeDirectory("~/Scripts/app", "*.js")
);