ionic framework - Data not updating in AngularJS -
i working on web app in ionic. here, have button in menu.html, when clicked should cause function in controllers.js add newdata "data" in appapi.js file getting error. can take look? here's code in menu.html , controllers.html: http://pastebin.com/gw0h2g3p , here appapi.js: http://pastebin.com/jbqqubcp
thanks!
in appapi
service
var adddata = function(newdata) { data[data.length] = newdata; } return { getdata: getdata };
adddata
private. it's not exposed.
in controller: trying access adddata not available.
$scope.add = function() { appapi.adddata($scope.newdata); }
to fix it: add adddata
return object in service
var adddata = function(newdata) { data[data.length] = newdata; }
return { getdata: getdata, adddata : adddata };
Comments
Post a Comment