restangular icon indicating copy to clipboard operation
restangular copied to clipboard

plain is not a function

Open chorsnell opened this issue 10 years ago • 5 comments

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)

chorsnell avatar Jun 02 '16 16:06 chorsnell

@poppahorse Can you have a better console print for your fields variable ? Maybe getList() doesn't return an object with plain capability.

igorissen avatar Jun 13 '16 12:06 igorissen

@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.

chorsnell avatar Jun 14 '16 12:06 chorsnell

I'm not sure why this isn't working. Can you please put up a Plunk?

daviesgeek avatar Jun 17 '16 00:06 daviesgeek

Closing due to the nature and age of issue. Please consider the updated issue guidelines and reopen if needed.

bostrom avatar Dec 30 '16 11:12 bostrom

I saw this error in our Sentry logger a couple of times. Was happening for random users but only in Mobile Safari browser.

valtumi avatar May 13 '19 04:05 valtumi