在精缩角JavaScript调试未知提供商 [英] Debugging Unknown provider in minified angular javascript

查看:119
本文介绍了在精缩角JavaScript调试未知提供商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个困难时期试图查明其中很多的,方法我在我的角度应用程序,会导致错误:

I'm having a hard time trying to pinpoint which, of the very many, methods I have in my angular app that would be causing the error:

未捕获的错误:[$喷油器:unpr]未知提供商:nProvider< - N

一旦JavaScript已被捆绑和放这只发生;通过ASP.Net精缩。

This only happens once the javascript has been bundled & minified by ASP.Net.

我已确保所有的控制器,以及任何其他的DI中,使用了缩小安全的方法,即我的控制器/服务等所使用的方法:

I have ensured that all the controllers, and any other DI, is using the minification-safe method, I.E My controllers/service etc are using the method:

appControllers.controller('myCtrl', ['$scope', function($scope){
        //......
}]);

我在我们的应用程序通过每一个JS文件了 - 还有很多...并不能找到任何违反注入依赖这种方式 - 虽然有必须有一个地方...

I've gone through every JS file in our app - there are a lot... and can't find anything that violates this way of injecting dependencies - though there must be one somewhere...

有没有更好的方法来查明该方法可能会造成这个错误?

Is there a better way to pinpoint which method could be causing this error?

感谢

推荐答案

正如评论中提到,这些都是我拿了,试图找到我的JS错误的步骤。

As mentioned in the comments, These are the steps I took to try and find my JS error.

如果有另一个,更方便,解决方案,请随意张贴它,我可以将其标记为接受。

If there is another, easier, solution, please feel free to post it and I may mark it as accepted.

要调试缩小的code是一个噩梦。

Trying to debug minified code is a nightmare.

我最终做的是复制我的精缩JavaScript中,直接从Chrome的督察。

What I eventually did was copy my minified javascript, directly from the inspector in Chrome.

我再粘贴到JS 的http://www.js$p$ptty.com/ - 我曾试图 http://jsbeautifier.org/ 却发现他们的网站冻结与这些大JS code。

I then pasted the JS into http://www.jspretty.com/ - I had tried http://jsbeautifier.org/ but found their site froze with such large JS code.

一旦它是'pretty-田间我在我的解决方案创建一个test.js文件,粘贴的,现在更容易阅读code,进去了。

Once it was 'pretty-fied' I created a test.js file in my solution and pasted the, now easier to read code, into it.

快人一步注释掉 @Script 标记我的 _layout ,并添加一个链接到test.js文件,我准备调试JavaScript的现在,更容易阅读,块。

Quick step to comment out the @script tag in my _layout and add a link to the test.js file and I was ready to debug a now, far easier to read, chunk of Javascript.

它仍然是pretty尴尬遍历调用堆栈,但现在你可以看到实际的方法,它使得它远不如不可能的。

It is still pretty awkward to traverse the call stack, though now you can see actual methods it makes it far less impossible.

这篇关于在精缩角JavaScript调试未知提供商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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