Add items from diferent pages to one specific page


#1

(bad english maybe avarage)
I created restourant app and i have all this different categories and items, and like i said in the title i want to click on all this random items (like you ordering stuff) and push it to specific page - like a shopping cart


#2

you can use localStorage like a small database in your application , on every page you can add or get your list of object ,

insert your array

localStorage.setItem('ListObject',array);

get your array


localStorage.getItem('ListObject');

PS: if you wanna add an object to your array you must get your array “ListObject” and add an object to this list before set list


#3

I think localStorage is not a great choice here. I would instead use either a shared service provider or NavParams.


#4

i used navParams (i don’t know if i used it correctly) and it works when i console log it
like this - > console.log(this.navParams.get(‘title’));
but when i want to display it on the page it doesent work - or maybe i do something wrong


#5

I wish we could get a moratorium on the phrase “it doesn’t work”. It conveys virtually zero useful information.

  • I used this code
  • I expected X to happen
  • Y actually happened