未捕获的TypeError:angular.lowercase不是函数 [英] Uncaught TypeError: angular.lowercase is not a function

查看:136
本文介绍了未捕获的TypeError:angular.lowercase不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

未捕获的TypeError:angular.lowercase不是函数

Uncaught TypeError: angular.lowercase is not a function

我的angularjs应用程序中出现此错误,并且整个应用程序未运行.这是在textAngular-sanitize.js:413中显示的.

this error in my angularjs application, and entire application is not running. This is its showing in textAngular-sanitize.js:413.

无法调试,我尝试使用与angular.js相同的版本,但未成功.请为此提供解决方案.除了控制台中的此错误消息外,我没有其他可共享的内容.

Not able to debug, i tried using same version as of angular.js, but no success. Please provide me solution for this. I dont have anything to share apart from this error message in console.

textAngular-sanitize.js:413 Uncaught TypeError: angular.lowercase is not a function
        at parseEndTag (textAngular-sanitize.js:413)
        at htmlParser (textAngular-sanitize.js:378)
        at textAngular-sanitize.js:147
        at textAngularSetup.js:443
        at Object.invoke (angular.js:5093)
        at angular.js:4892
        at forEach (angular.js:374)
        at createInjector (angular.js:4892)
        at doBootstrap (angular.js:1923)
        at bootstrap (angular.js:1944)

推荐答案

如您所见

As you can see here, angular deprecated their lowercase util method.

您使用的库尚未更新,因此仅与1.6.7之前的Angular版本兼容.但是由于出现此错误,因此使用的角度版本可能更高.

The library you use has not updated yet and is therefore only compatible with an angular version before 1.6.7. But since you get this error, the angular version you use is probably higher.

您可以

(A)在bower.json中将角度降级到1.6.7:

"dependencies": {
   "angular": "1.6.7",
   ...
}
"resolutions": {
   "angular": "1.6.7"
}

(B)通过添加如下方法创建一个简单的解决方法:

angular.lowercase = text => text.toLowerCase();

确保在加载angular之后但在应用启动之前完成此操作.

Make sure this is done after angular is loaded but before your app starts.

这篇关于未捕获的TypeError:angular.lowercase不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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