使用.NET MVC捆绑微小错误AngularJS [英] AngularJS with .NET MVC Bundling Minification Error

查看:530
本文介绍了使用.NET MVC捆绑微小错误AngularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发一个.NET MVC网站内大AngularJS应用。我已经走了的方式长时间没有测试它是否会使用捆绑Optimiazation特点sucesfully minifiy?

I have been developing a large AngularJS application inside of a .NET MVC Website. I've gone way to long without testing if it will sucesfully minifiy using the Bundle Optimiazation Features?

BundleTable.EnableOptimizations = True

当然还有,它失败。我一直在玩我捆绑我的脚本命令,并确保我使用字符串文字对我的控制器名称(我是不是,这是一个很大的重构,我将不得不这样做的)。

And of Course, it fails. I've been playing with the Order I bundle my scripts, and ensuring I am using String Literals for my Controller Names (I wasn't, and that is a lot of re-factoring that I will have to do).

但我不能让我的核心脚本来Minifiy无角未知供应商的错误。

But I can not get my Core Scripts to Minifiy without the angular "Unknown Provider" error.

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

Here is the exact Error: Uncaught Error: [$injector:modulerr] [http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=ppAccount&p1=Error…redScripts%3Fv%3DknV3wkCOg32ajaw4GwiRSrTXdo8Ue7MRIn65CPYa1b81%3A1%3A379851)]1

下面是我的失败捆绑的配置:

Here is my bundle config that is failing:

            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"

有关我的生活,我不能找出哪些依赖性没有被解决。我觉得,如果我能范围缩小到一个特定的依赖性,我知道我可以解决这个问题。

For the life of me, I can't figure out which dependency isn't being resolved. I feel that if I can narrow it down to a specific dependency I know I can solve the issue.

有没有办法追查导致该问题的特定模块?

Is there any way to track down the specific Module that is causing the issue?

如何使这项工作有什么建议?

Any suggestions on how to make this work?

感谢您的帮助。

推荐答案

您应该始终遵循严格的二,同时注入的依赖(数组符号)

You should always follow strict di while injecting dependency (Array notation)

Angualar文件已经提到,不要遵循严格的DI,而这样做微小,否则它可能会破坏你的应用程序

Angualar Doc has mentioned that, Do follow strict DI while doing minification, otherwise it could break you app

如:(code)

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

上面的例子中code有依赖注入内部数组符号&安培;还有通过创建控制器功能里边有对象使用,同样严格的二应遵循所有code为服务,供应商,控制器,过滤器等。

Above sample code has dependency injecting inside array notation & there are used by creating there object inside controller function, same strict-di should be followed in all code for service, provider, controller, filter, etc.

这篇关于使用.NET MVC捆绑微小错误AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆