(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
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
I think localStorage is not a great choice here. I would instead use either a shared service provider or NavParams
.
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
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