Having trouble doing insertion in SQLiteDatabase

I am having trouble doing insertion in SQLiteDatabase in ionic framework. I added cordova-sqlite-storage plugin, my problem is data is not being inserted, I am not getting any message when I hit INSERT button, can someone tell my what is my mistake here?

This is my index.html

<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">

<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
    <script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>
<body ng-app="starter">
<ion-header-bar class="bar-stable">
<h1 class="title">Test app</h1>
<ion-content ng-controller="MainCtrl">
<div class="list">
<label class="item item-input">
<input type="text" placeholder="Name" ng-model="fullname">
<label class="item item-input">
<input type="text" placeholder="E-mail" ng-model="email">
<button class="button button-full button-positive" ng-click="insert(fullname, email)">INSERT</button>

and this is my app.js

var db = null;
var app = angular.module('starter', ['ionic', 'ngCordova'])
.run(function($ionicPlatform, $cordovaSQLite) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
if (window.StatusBar) {

db = $cordovaSQLite.openDB("demo.db");
$cordovaSQLite.execute(db, 'CREATE TABLE IF NOT EXISTS user(id INTEGER PRIMARY KEY AUTOINCREMENT, fullname TEXT, email TEXT)');



app.controller('MainCtrl', function($scope, $cordovaSQLite) {
$scope.insert = function(fullname, email) {
$cordovaSQLite.execute(db, 'INSERT INTO user (fullname, email) VALUES (?,?)', [fullname, email])
.then(function(result) {
$scope.statusMessage = "data saved";
}, function(error) {
$scope.statusMessage = "error on saving: " + error.message;


See my best example using service pattern :slight_smile:

Regards, Nicholls