AngularJS与.NET MVC捆绑最小化错误



我一直在开发一个内部的大型AngularJS应用程序。NET MVC网站。我已经很久没有测试它是否会成功地使用捆绑优化功能?

BundleTable.EnableOptimizations = True

当然,它失败了。我一直在玩捆绑脚本的顺序,并确保我的控制器名称使用字符串文字(我没有,这是我必须做的很多重新考虑)。

但如果没有角度"未知提供者"错误,我就无法将我的核心脚本最小化。

以下是确切的错误:未捕获错误:[$injector:modulerr][http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=ppAccount&p1=错误…redScripts%3V%3DknV3wkCOg32ajaw4GwiRSrTXdo8Ue7MRIn65CPYa1b81%3A1%3A379851)]1

这是我失败的捆绑包配置:

bundles.Add(new ScriptBundle("~/bundles/PilotPartnerRequiredScripts")
.Include(
"~/UI/js/jquery/jquery-2.1.3.js",
"~/UI/js/plugins/jquery-ui/jquery-ui.js",
"~/UI/js/bootstrap/bootstrap.js",
"~/UI/js/plugins/pace/pace.min.js",
"~/UI/js/plugins/slimscroll/jquery.slimscroll.js",
"~/UI/js/inspinia.js",
"~/UI/js/angular/angular.js",
"~/UI/js/ui-router/angular-ui-router.js",
"~/UI/js/bootstrap/ui-bootstrap-tpls-0.12.1.js",
"~/UI/js/angular/angular-resource.js",
"~/UI/js/angular/angular-sanitize.js",
"~/UI/js/angular/angular-route.js",
"~/UI/js/plugins/switchery/switchery.js",
"~/UI/js/plugins/angular-ui-switch/angular-ui-switch.js",
"~/UI/js/plugins/angularLocalStorage/angular-local-storage.js",
"~/UI/js/plugins/ngDialog/ngDialog.js",
"~/Scripts/ngTags/ng-tags-input.js",
"~/Scripts/uiSortable/sortable.js",
"~/Scripts/kendo/2014.3.1119/kendo.all.min.js",
"~/Scripts/xeditable/xeditable.js"

就我的一生而言,我不知道哪种依赖没有得到解决。我觉得如果我能把它缩小到一个特定的依赖关系,我知道我可以解决这个问题。

是否有任何方法可以追踪导致问题的特定模块?

关于如何使这项工作发挥作用,有什么建议吗?

谢谢你的帮助。

在注入依赖项(数组表示法)时,应始终遵循严格的di

Angualar Doc已经提到,在进行缩小时,请遵循严格的DI,否则可能会破坏您的应用程序

例如。(代码)

angular.module('myModule', [])
.factory('serviceId', ['depService', function(depService) {
// ...
}])
.directive('directiveName', ['depService', function(depService) {
// ...
}])
.filter('filterName', ['depService', function(depService) {
// ...
}]);

在上面的片段中,我遵循了DI的内联数组表示法,它已经应用于各种角度组件上,只是为了演示它。无论在哪里注入依赖项,都应该确保遵循它。

最新更新