I encountered the following issue:
{"__zone_symbol__currentTask":{"type":"microTask","state":"notScheduled","source":"Promise.then","zone":"angular","cancelFn":null,"runCount":0}}
I have a defined class where I am invoking a method that returns a Promise....
export class TechPRODAO {
sqlite: any;
db: SQLiteObject;
constructor() {
this.sqlite = new SQLiteMock();
this.sqlite.create({
name: 'techpro.db',
location: 'default'
}).then((_db: SQLiteObject) => {
this.db = _db;
});
};
public executeSql(sqlstatement: string, parameters: any): Promise<any> {
return this.db.executeSql(sqlstatement, parameters);
}
Below is where the call is made
export class AppointmentDAO {
techprodao: TechPRODAO;
constructor(_techprodao: TechPRODAO) {
this.techprodao = _techprodao;
};
public insertAppointment(appointment: Appointment) {
console.log("insertAppointment called");
this.techprodao.executeSql("INSERT INTO appointment (ticketnumber, customername, contactemail, contactphone, status, location, paymenttype, description, hascontract) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)", [appointment.ticketnumber, appointment.customername, appointment.contactemail, appointment.contactphone, appointment.status,
appointment.location, appointment.paymenttype, appointment.description, appointment.hascontract])
.then((data) => {
console.log("Inserted into appointment: ticketnumber=" + appointment.ticketnumber);
}, (error) => {
console.log("ERROR in insertAppointment: " + JSON.stringify(error));
});
}
The error occurs during the executeSql function in insertAppointment, and I am puzzled as to why it is not properly triggering the "then" statement.