In the success() callback of an $http.post() call, I am attempting to update an HTML table:
.success(function (data) {
$scope.categories.push(data);
});
HTML:
<tbody>
<tr ng-repeat="category in categories">
<td>{{category.Id}}</td>
<td>{{category.CategoryTypeID}}</td>
<td>{{category.IsContentLibraryItem}}</td>
<td>{{category.Title}}</td>
<td>{{category.CreatedBy}}</td>
<td>{{category.CreatedDate}}</td>
</tr>
</tbody>
The result, however, is an empty row at the bottom of the table, and I believe this is because the success() function is executing before the post() function is complete. The new data isn't finished being written before success() is pushing a new (empty) row to the HTML table.
I need some way of delaying the $scope.categories.push(data);
line until the post() is truly complete. I seem to recall that with jQuery/Ajax there was an onComplete() event or something like that, but is there an equivalent in AngularJS?