I have page with table and data shows via ng-repeat and ng-model. When I click save button I call post service and that posts my data to db and returns me id in callback. How I can save response to my object?
in controller:
$scope.saveTask = function (workflow) {
if (workflow.isSaved == false) {
workflow.isSaved = true;
$scope.Task.push($scope.newTask());
restService.postArbitraryTask(angular.toJson(workflow));
}
};
in rest-service:
postArbitraryTask: function (model, callback) {
$http({
method: 'POST',
url: Global.api.saveArbitraryTask,
contentType: 'application/json; charset=utf-8',
data: model
}).success(function (response) {
console.log(response);
if (callback) {
callback(response);
}
}).error(function() {});
},