gpt4 book ai didi

1.7.0 上的 AngularJS ngSanitize 错误

转载 作者:行者123 更新时间:2023-12-01 04:40:49 28 4
gpt4 key购买 nike

我有很多这个错误:
AngularJS ngSanitize Error

简短版本:“小写不是函数”。

虽然我的应用程序将 AngularJS 强制为 1.4.9,但我们没有强制执行 angular-sanitize,因此它解析为 1.7.0 并且在该版本的 AngularJS 上小写函数不再存在,从而产生错误。

可能通过强制 angular-sanitize 到固定版本可以解决这个问题,但我想超越修复它并了解导致问题的原因以及原因,因为我发现了一些不一致之处。

  • AngularJS 被强制升级到 1.4.9。 bower-components 文件夹保存这个版本,编译后的 build 文件夹也保存这个版本,Chrome 上的开发者面板只显示这个版本被获取。这个版本确实有小写方法。
  • Angular-sanitize 将 angular 1.7.0 作为依赖项,但从未下载过,也从未下载过。不在整个项目的任何单个文件夹或子文件夹中,不在编译时,也不在 Chrome 中。所以我猜他唯一可以访问的 angular.js 是 1.4.9,它确实有小写方法。

  • 如果唯一可用的 angular.js 仍然具有该方法,我不太明白为什么会出现“小写不是函数”错误。另外我不明白为什么 angular-sanitize 1.7.0 要求 angular 1.7.0 在 AngularJS 1.7.0 上使用不存在的方法(Angular 开发人员错了?但我觉得很难相信。)

    可能 sanitize 正在以某种方式下载和访问 angular 1.7.0,但我想知道如何。只是出于好奇。还要确认这是 angular 开发人员的错误还是我遗漏了什么。

    最佳答案

    在官方 Angular 1.6 to 1.7 Migration Guide 中有解释:

    Due to 1daa4f, the helper functions angular.lowercase and angular.uppercase have been removed.

    These functions have been deprecated since 1.5.0. They are internally used, but should not be exposed as they contain special locale handling (for Turkish) to maintain internal consistency regardless of user-set locale.

    Developers should generally use the built-ins toLowerCase and toUpperCase or toLocaleLowerCase and toLocaleUpperCase for special cases.

    Further, we generally discourage using the angular.x helpers in application code.

    关于1.7.0 上的 AngularJS ngSanitize 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50326865/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com