Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

saving labels to array

Please use prefavorites.push(new_item);/pre instead prefavorites.append(new_item);/pre

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

Thanks that solved the error.

I now have the array saving in local storage,
I tried to create a put service, but I am getting error

Image

this is the service settings

Image

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

Image

mapping with the following js

codecode

Image

/code/code

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

codereturn JSON.parse(localStorage.getItem("favorites"));/code

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

saving labels to array

Hi Michael,

Field "favorites" in your collection stores a string, not an object. That is, you don't need code:codereturn JSON.parse(localStorage.getItem ("favorites"));/code

When you request the data from database you would need to take into account that it is a string you need to convert into the structure.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

Katya,
in this service its a put
i have removed above code
return JSON.parse(localStorage.getItem ("favorites"));

and I get this in the console

Image

Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

saving labels to array

Hi Michael,

You don't have the object of service settings or it is not specified in service settings. The problem is that {database_url} doesn't exist. You need to define it as a parameter database_url or connect settings object, which specifies this parameter.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

I sorry Katya,
I dont understand

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

saving labels to array

Hi Michael,

Please take a look at screen shot

Image

Return to “Issues”