Cordova not avaliable

Hi,
I am new for ionic and i am creating mobile app using cordova +anjular+ionic .For that i using sqllite to connecting database during this time "CORODOVA not available" this error showing pls help me
below my code:

Database.ts
import { Injectable } from ‘@angular/core’;
import { Platform } from ‘ionic-angular’;
import { SQLite, SQLiteObject } from ‘@ionic-native/sqlite’;
import { SQLitePorter } from ‘@ionic-native/sqlite-porter’;
import { Http } from ‘@angular/http’;
import ‘rxjs/add/operator/map’;
import { BehaviorSubject } from ‘rxjs/Rx’;
import { Storage } from ‘@ionic/storage’;

/*
Generated class for the DatabaseProvider provider.

See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class DatabaseProvider {
ready: Promise;
database: SQLiteObject;
private databaseReady: BehaviorSubject;

constructor(public sqlitePorter: SQLitePorter, private storage: Storage, private sqlite: SQLite, private platform: Platform, private http: Http) {
this.databaseReady = new BehaviorSubject(false);
this.platform.ready().then(() => {
this.sqlite.create({
name: ‘developers.db’,
location: ‘default’
})
.then((db: SQLiteObject) => {
this.database = db;
this.storage.get(‘database_filled’).then(val => {
if (val) {
this.databaseReady.next(true);
} else {
this.fillDatabase();
}
});
});
});
}

fillDatabase() {
this.http.get(‘assets/icon/main.sql’)
.map(res => res.text())
.subscribe(sql => {
this.sqlitePorter.importSqlToDb(this.database, sql)
.then(data => {
this.databaseReady.next(true);
this.storage.set(‘database_filled’, true);
})
.catch(e => console.error(e));
});
}

addDeveloper(name, skill, years) {
let data = [name, skill, years]
return this.database.executeSql(“INSERT INTO developer (name, skill, yearsOfExperience) VALUES (?, ?, ?)”, data).then(data => {
return data;
}, err => {
console.log('Error: ', err);
return err;
});
}

getAllDevelopers() {
return this.database.executeSql(“SELECT * FROM developer”, ).then((data) => {
let developers = ;
if (data.rows.length > 0) {
for (var i = 0; i < data.rows.length; i++) {
developers.push({ name: data.rows.item(i).name, skill: data.rows.item(i).skill, yearsOfExperience: data.rows.item(i).yearsOfExperience });
}
}
return developers;
}, err => {
console.log('Error: ', err);
return ;
});
}

getDatabaseState() {
return this.databaseReady.asObservable();
}
}

Home.ts

export class HomePage {

developer = {};
developers = ;

constructor(public navCtrl: NavController,public app:App, private databaseprovider: DatabaseProvider, private platform: Platform) {
// this.databaseprovider.getDatabaseState().subscribe(rdy => {
// if (rdy) {
// this.loadDeveloperData();
// }
// })
}

loadDeveloperData() {
this.databaseprovider.getAllDevelopers().then(data => {
this.developers = data;
})
}

addDeveloper() {
this.databaseprovider.addDeveloper(this.developer[‘name’], this.developer[‘skill’], parseInt(this.developer[‘yearsOfExperience’]))
.then(data => {
this.loadDeveloperData();
});
this.developer = {};
}

logout(){
// Remove API token
const root = this.app.getRootNav();
root.popToRoot();
}

My error

SQLite is not available on ionic serve. None of the cordova features… (well actually, most of them)

Thanks,
but see below link they connect and getting data,
https://devdactic.com/ionic-sqlite-queries-database/

Otherwise help me i am doing offline project with the help of IOnic3+angular4 for that i need sql lite connect with ionic for that if you have any samples are how to do it any documentation?help!

Like @Tommertom said, Cordova does not work in ionic serve you should run you app on a device.

If you read through the link you have posted yourself they do warn you for this aswell:

That’s all, now you only need to make sure you run this app on a device/simulator as we make use of the underlying SQLite database which is not available inside your browser if you use the preview or lab function!

Try running in Ionic View. That supports sqlite as well. But not the other plugin in the link you provided

Pls send any code examples or links to that

Just use the ionic cordova run ios or ionic cordova run android commands depending on what device you use and debug on the device itself.

I suggest you go through the tutorials and docs on ionicframework, and angular.io

Please tell us when you are finished…