I need to insert 30,000 records in the device (in SQLite) through a file. But at the time of insertion, the application hangs. So I thought of creating an asynchronous service, but I do not know how to do this using Angular 2.
Code:
this._http.get('assets/fishes.sql').subscribe(data => {
var queries = data.text().split(";");
for (var i = 0; i < queries.length; i++) {
var currentQuery = queries[i];
this.populaFishes(db, currentQuery);
}
});
How can I create a service that runs in background so that the application does not crash using Angular 2?