I can not use this native (side menu, ionic 2)


#1

I can not use this native (side menu, ionic 2)

page1.ts

import { Component } from ‘@angular/core’;
import { NavController, NavParams } from ‘ionic-angular’;
import { SQLite } from ‘ionic-native’;

@Component({
selector: ‘page-page1’,
templateUrl: ‘page1.html’
})
export class Page1 {

public carrinho: Array;

constructor(public navCtrl: NavController) {
let db: SQLite = new SQLite();
db.openDatabase({
name: “mercado.db”,
location: “default”
}).then(() => {
var sql_Tables = ‘’;

  sql_Tables +="select * from `tb_carrinho`";
   db.executeSql(sql_Tables, {}).then((sucesso) => {
    alert('Tabelas ok');
  }, (error) => {
    alert("Unable to execute messages sql: "+error);
  });

}, (error) => {
   alert("Unable to open database: "+error);
});

}


#2

I assume that you use prepopulated database on which not supported on this plugin. You should create first the table since it’s an empty database.


#3

Is there a chance this code is getting called before the platform is ready?


#4

I do not know informs, I’m using sidemenu ionic 2