未捕获的TypeError:angular.lowercase不是函数
我的angularjs应用程序中出现此错误,并且整个应用程序未运行.这是它的表现textAngular-sanitize.js:413.
无法调试,我尝试使用与angular.js相同的版本,但没有成功.请为我提供解决方案.我没有任何东西可以在控制台中与此错误消息分享.
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)
Run Code Online (Sandbox Code Playgroud) 我从html代码的API字符串获取,其中可能包含来自以下服务的嵌入视频:
如果我确定它足够安全,我可以将它们转换为可信的SafeHtml(绕过Angular的消毒剂):
this.safeHtml = this._sanitizer.bypassSecurityTrustHtml(this.htmlFromApi);
Run Code Online (Sandbox Code Playgroud)
然后将它放在这样的页面上:
<div [innerHtml]="safeHtml"></div>
Run Code Online (Sandbox Code Playgroud)
问题:
我必须执行哪些检查才能确保此字符串足够安全?(它不包含嵌入式脚本,只导致这四个站点中的一个没有任何棘手的重定向)?
以某种方式将这些网站添加到Angular的消毒剂的例外中是否有意义?如果是的话怎么做?
提前致谢!
ps我看到了类似的问题:如何检查HTML字符串是否安全? 但我希望Angular最佳实践有一些更新鲜和相关的东西