title: When called opendatabase in angular factory, it thows security_err dom exception 18 error
body: <p>I am developing Angularjs app in vs2015.
  I want to open database in websql through factory function. While testing app in ripple emulator it works perfectly(also works perfectly in android OS version 4.4 and higher) but while testing app in android OS version 4.2 and lower it throws <code>security_err dom exception 18</code>.
  One more strange is that when same database, I open in simple java script file it works perfectly in ripple and in all devices also.</p>
  
  <p>Here is my factory code :</p>
  
  <pre><code>angular.module('InnkeyAlert.services', ['InnkeyAlert.config'])
  
  // DB wrapper
  
  .factory('DB', function ($q, DB_CONFIG) {
  
  try {
      var self = this;
      self.db = null;
  
      self.init = function () {
          alert("DB init start!");
          // Use self.db = window.sqlitePlugin.openDatabase({name: DB_CONFIG.name}); in production
          self.db = window.openDatabase(DB_CONFIG.name, '1.0', 'database', -1);
          alert("DB open!");
          angular.forEach(DB_CONFIG.tables, function (table) {
              var columns = [];
  
              angular.forEach(table.columns, function (column) {
                  columns.push(column.name + ' ' + column.type);
              });
  
              var query = 'CREATE TABLE IF NOT EXISTS ' + table.name + ' (' + columns.join(',') + ')';
              self.query(query);
              //console.log('Table ' + table.name + ' initialized');
          });
          alert("table created !");
      };
  
      return self;
  
  } catch (e) {
      //alert("Db factory: "+e.message);
  }
  
  })
  </code></pre>
  
  <p>Here is my index.js file code :</p>
  
  <pre><code>    var app = {
  
          // Application Constructor
          initialize: function () {
              this.bindEvents();
          },
          // Bind Event Listeners
          //
          // Bind any events that are required on startup. Common events are:
          // 'load', 'deviceready', 'offline', and 'online'.
          bindEvents: function () {
              alert("hi");
              document.addEventListener('deviceready', this.onDeviceReady, false);        
          },
  
          // The scope of 'this' is the event. In order to call the 'receivedEvent'
          // function, we must explicitly call 'app.receivedEvent(...);'
          onDeviceReady: function () {
              app.receivedEvent('deviceready');
              alert("Device ready end...");
              try {
                  angular.injector(['InnkeyAlert']).get('DB').init();
                  alert("inti db called...");
              } catch (e) {
                  alert("index 101: " + e.message);
              }
          },
          // Update DOM on a Received Event
          receivedEvent: function (id) {
  
          }
      };
  </code></pre>