Pavan Alapati
Pavan Alapati

Reputation: 635

How add data into JSONStore IBM MobileFirst

We are new to IBM-MobileFirst. We need create,insert,get,delete data in JSONStore. So We tried like this:

main.js:-

function wlCommonInit(){
    console.log("Bootstrapping Angular");
    angular.element(document).ready(function(){
        angular.bootstrap(document,['app']);
          var collectionName = 'people';
           var options = {};
               options.username = 'pavan';
               options.password = '123';
               options.localKeyGen = false;
               options.clear = false;
               WL.JSONStore.init(collectionName, options).then(function () {
                  alert("OK");
                  WL.JSONStore.get(collectionName).add([{name: 'carlos'}, {name: 'mike'}])
                   .then(function () {
                       alert("OK3");
                   });
              }).fail(function (errorObject) {
                  alert("fail");
              });
    })
}

First We are getting alert Ok next it's showing Error in console

Uncaught TypeError: Cannot read property 'add' of undefined

We understand insert into table using add.Get all records using findAll,delete using remove, but problem is add function not working. So tell me what we miss and guide to us.

Upvotes: 0

Views: 184

Answers (0)

Related Questions