@mpreyes wrote:
First time building an Ionic 2 app and I was looking for some advice.
For simplicity's sake, I have created a project in which I will implement on a bigger scale in my real project.
I have two pages, one collects a name and another collects the age. I am attempting to use a provider that holds an object like personData into which I can push the user submitted values to.
How do I achieve this? Basically, I want to push the data from each page to a single object instance that has those attributes already defined. ( I would then push the object to an object array and save it using Ionic's storage module)
I have a provider called database which holds dummy data:
export class Database { database: any; constructor(public http: Http) { console.log('Hello Database Provider'); this.database = [ {name: 'Homer', age: '45'}, {name: 'Candace', age: '23'}, ] } loadAll() { return Promise.resolve(this.database); } }
how do I push to this provider? (and is this even the best way to do this?)
Right now I am pushing the data from page to page using navController, but it seems like there should be a better way.
Posts: 2
Participants: 2


