All my searching has found posts on ionic 1. on the following code I am able use this.corpguys in ng*For and save to local storage. I want to take my Apps further and save this to a sqlite table corpguys. I am not sure if I have to JSON.stringify(data) and then loop through to insert this data into to db. i am just wondering if anyone has seen examples of this with ionic 2
import {Page, Storage, SqlStorage} from 'ionic/ionic';
import {Http} from 'angular2/http';
import 'rxjs/add/operator/map';
@Page ({
templateUrl: 'build/pages/remote/remote.html',
})
export class Remote {
constructor(http: Http) {
this.http = http;
//this.corpguys = null;
this.http.get('http://test.json')
.map(res => res.json())
.subscribe
(data => {
this.corpguys = data;
//Loop through corpguys and asign varible names
this.DataStorage = new Storage(SqlStorage);
this.DataStorage.query("INSERT into corpguys (name, position, phone, cell, sms, email, other) VALUES ('namevalue', 'positionvalue', 'phonevalue', 'cellvalue', 'smsvalue', 'emailvalue', 'othervalue')");
},
err => {
console.log("screwed up again!")
}
});
}