plain is not a function
Having some strange issues where I can't get plain() working. I also seem to be the only person on the internet having this issue (so probably something silly).
Angular: 1.5.5 Restangular: 1.5.2
Before I try to recreate in a plunkr, any ideas?
var ctype = Restangular.all('ctype/');
ctype.getList().then(function(fields) {
console.log(fields);
console.log(fields.plain());
});
Output in console
[Object, Object, Object, route: "ctype/", reqParams: null, $fromServer: true, parentResource: null, restangularCollection: true] angular.js:13550 TypeError: fields.plain is not a function at modules.js:280 at angular.js:15961 at n.a.$get.n.$eval (angular.js:17229) at n.a.$get.n.$digest (angular.js:17045) at n.a.$get.n.$apply (angular.js:17337) at l (angular.js:11572) at H (angular.js:11778) at XMLHttpRequest.u.onload (angular.js:11711)
@poppahorse Can you have a better console print for your fields variable ? Maybe getList() doesn't return an object with plain capability.
@igorissen You are right, it doesn't, but why whould that be? I will try and get a better output of the object later, but its definitely a restangularised object, and it definitely doesn't reference plain within it.
I'm not sure why this isn't working. Can you please put up a Plunk?
Closing due to the nature and age of issue. Please consider the updated issue guidelines and reopen if needed.
I saw this error in our Sentry logger a couple of times. Was happening for random users but only in Mobile Safari browser.