我正在使用 loopback-angular-sdk ,并且在使用updateAttributes函数时出现了一个奇怪的错误:
MyModel.prototype$updateAttributes is not a function
它发生在所有型号上。我有点怀疑依赖问题。
我在我的index.html中包含了angular-resource.js,所以这不是问题。
这是我的bower.json:
{
"name": "angular",
"version": "1.0.0",
"dependencies": {
"bootstrap": "^3.3.7",
"angular": "1.6.1",
"angular-route": "latest",
"angular-material": "^1.1.1",
"angular-ui-router": "^0.3.2",
"angular-resource": "1.6.1",
"material-calendar": "^0.2.14",
"textAngular": "^1.5.16",
"jquery": "^3.1.1",
"material": "^0.1.1",
"angular-material-data-table": "^0.10.10",
"moment": "^2.17.1",
"angular-translate": "^2.13.1",
"angular-translate-loader-static-files": "^2.13.1",
"angular-translate-storage-local": "^2.13.1",
"angular-animate": "1.6.1",
"angular-aria": "1.6.1",
"angular-recaptcha": "^4.0.3",
"angular-i18n": "1.6.1",
"angular-dynamic-locale": "^0.1.32"
},
"resolutions": {
"angular": "1.6.1",
"angular-material": "^1.1.1"
}
}
非常感谢任何帮助。谢谢!
答案 0 :(得分:1)
如果您使用Loopback ^ 3x,那么他们已将方法名称从prototype$updateAttributes
更改为prototype$patchAttributes
以获取Angular SDK。我没有在任何地方找到这个文档,并且必须通过阅读生成的lb-services.js
只需使用新方法prototype$patchAttributes
,您应该是金色的。