So i have an array of objects that i return from the server(working with an API), now i want to pass those objects to another page(detailpage) one at a time based on the object(id). So when users click on it, it they are redirected to the detail page and it displays the data for that particular item click upon… am still very new with ionic and i wanna get better in no time.
this is what i have the arrays page
In your first code snippet you say detail = this.rides.id.
In your second one you get what is in detail. And then you try to read detail.id. But detail only got the ID as it’s value - not an array with a key id.
Look at what console.log(this.ridedetail) returns instead of your last two lines.
I have an array of objects but i want to pass one object a time to that set page. I was thinking mapping out the id will pass the object alonside. But it doesn’t work that way.
I have an array [ ] and i wanna pass that object to the next page and then display the data there.
Be very careful here if you are ever modifying these objects. It is risky to rely on any particular passing semantics here. Maybe NavController passes a direct object reference, so modifications made by page B will be reflected in the object held in page A (which may or may not be desirable). Maybe it will go through stringification, so the two objects are decoupled. Maybe that will change tomorrow. It’s outside the scope of something you should rely on either way. Program defensively.