Biffy
Biffy

Reputation: 871

Angular-Loopback-SDK: prototype$updateAttributes is not a function

I'm using the loopback-angular-sdk and I am getting a weird error when using the updateAttributes function:

MyModel.prototype$updateAttributes is not a function

It happens on all models. I'm kind of suspecting an dependency issue.

I included the angular-resource.js in my index.html, so that's not the problem.

This is my 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"
  }
}

Any help would be greatly appreciated. Thank you!

Upvotes: 0

Views: 475

Answers (1)

jwebcat
jwebcat

Reputation: 31

If you are using Loopback ^3x then they have changed the method name from prototype$updateAttributes to prototype$patchAttributes for the Angular SDK. I have not found this documented anywhere and had to figure it out by reading the source code of the generated lb-services.js

Just use the new method prototype$patchAttributes and you should be golden.

Upvotes: 1

Related Questions