发现的原因和QUOT;未知提供商QUOT;错误 [英] Finding the cause of "Unknown provider" errors

查看:173
本文介绍了发现的原因和QUOT;未知提供商QUOT;错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误:

Error: [$injector:unpr] Unknown provider: nProvider <- n

我知道这是正在由微小的过程造成的,我明白为什么。但是有一种简单的方法来确定哪些文件实际上是导致了问题?

I know this is being caused by the minification process and I understand why. However is there an easy way to determine which file is actually causing the issue?

推荐答案

角1.3.x中有放置为NG-应用指令在相同的元素的NG-严格二指令。该元素将导致您的应用程序依赖时没有注明抛出一个错误。虽然现在还是不给你得罪code的行号,但它确实给你它的参数的功能(即功能($范围,服务名)),这是希望够独特,你可以找到它pretty迅速在一个良好的code编辑。

Angular 1.3.x has an ng-strict-di directive that is placed on the same element as the ng-app directive. This element causes your app to throw an error whenever dependencies have not been annotated. While it still doesn't give you the line number of the offending code, it does give you the function with its parameters (i.e. function($scope, myServiceName)) which is hopefully unique enough that you can find it pretty quickly in a good code edit.

该指令的一个很好的概述:<一href=\"http://bartwullems.blogspot.com/2014/10/angularjs-13-ng-strict-di-directive.html\">ng-strict-di.

A good overview of the directive: ng-strict-di.

这篇关于发现的原因和QUOT;未知提供商QUOT;错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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