javascript - encodeUriSegment 不是函数

标签 javascript angularjs angular-resource

Angular 返回控制台错误

encodeUriSegment is not a function

当我尝试在我自己的 Controller 中从 angular-resource 调用 get 函数时,就会发生这种情况。看起来 angular-resource 找不到这个函数,但它存在于 angular.js 文件中。我通过 bower 安装了 angular-resource。我在 index.html 中有我需要的每个文件路径。

完整错误信息:

angular.js:13920 TypeError: [horoskopy_App Error] encodeUriSegment is not a function
    at http://localhost:3000/bower_components/angular-resource/angular-resource.js:573:30

最佳答案

您的源代码中可能存在版本冲突。我遇到了同样的问题,发现我使用的是 angular-resource 1.5.9 和 angular 1.6。一旦我在同一个版本上发布,问题就解决了。

关于javascript - encodeUriSegment 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39226301/

相关文章:

javascript - 使用python抓取javascript查询生成的元素

javascript - Wordpress 和 Bootstrap : Dropdown menu does not works

javascript - 创建回调函数而不是使用标志 var 来控制特定函数何时完成

javascript - 由 jquery.blur() 引起的 Inprog 操作已在进行中

angularjs - Kendo-UI 数据存储利用 Angular $resource

javascript - 从 $resource.get Promise 中提取 JSON 对象

javascript - 文本不会对齐或移动

javascript - Ionic - 从上一页获取 ID 以使用下一页上的新数据进行更新

angularjs - Angular 单元测试-同一服务中的模拟方法/封闭

javascript - 所有资源解析后如何执行函数?