-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property ‘then’ of undefined while using ionic-v4 with Sqlite #67
Comments
@ferdiaddawy Did you ever get the answer to your question? I'm experiencing the same thing. Before diving into the plugin code I was gonna take the logic out of the service contructor and add it to a method. Once this was completed I was then going to use use APP_INITALIZER to call to that method. But..if you have an easier fix please let me know |
Nevermind I figured out the issue. For anyone in the future, this happens when cordova is not available. if you go to the plugin code, check the create method, and log the function checkAvailability, it will return an error node. if you google that, you should find the answer. Theres no if else statement. So it literally does nothing when cordova is not available instead of return an error message thats useful. |
@mrterry06 provide the solution please im stuck with that |
@mehthaf ionic cordova run browser. Cordova needs plugins to run in browser. This command should install the browser plugins. You could also run android or ios to |
Transferred to |
Presento el mismo error, pero estoy usándolo con capacitor , no estoy con cordova. |
I found the problem
core.js:15714 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'then' of undefined
TypeError: Cannot read property 'then' of undefined
import { Injectable } from '@angular/core';
import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';
import { Platform } from '@ionic/angular';
@Injectable({
providedIn: 'root'
})
export class ApilocalService {
database : SQLiteObject = null;
constructor(
private platform: Platform,
public sqlite: SQLite
) {
}
`import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { SQLite } from '@ionic-native/sqlite/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule
],
providers: [
StatusBar,
SQLite,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
`
can anybody help me to solve this.
Regards
The text was updated successfully, but these errors were encountered: