angularjs - Displaying server data on angular js Grid -
in offline web app , want dispaly server data on angularjs grid. have jsfiddle example new jsfiddle
it displays default data .
this code sync server
$('#btnsyncserver').click(function () { var customers = []; db.linq.from(config.objectstorename).select().then(function () { if (customers.length > 0) { var postdata = { revision: parseint(localstorage.customerrevision, 10), appid: config.appid, customers: customers }; $.ajax({ url: 'api/service', type: 'post', datatype: 'json', contenttype: "application/json", data: json.stringify(postdata), success: function (data) { if (data.revision == localstorage.customerrevision) { alert('there newer version on server. please sync server first.'); } else { syncdata(data); } } });
this modified far in jsfiddle example
self.readall = function () { return $http({ method: 'get', url: baseurl + objectname, headers: anonymoustoken }).then(function (response) { return response.data; }); }; }());
html side :
<div ng-app="app"> <div ng-controller="mainctrl"> <div ui-grid="gridoptions" class="grid"></div> </div> </div>
i usedurl: 'api/service',
in modifed example gives me 'failed connect.." error . trying connect local database there other way display server data in grid ?