My goal is to display the contents of ng-repeat after making an AJAX call using $http.
<table ng-controller="TableController as tc">
<tr>
<th>Date</th>
<!-- other headers are here -->
</tr>
<tr ng-repeat="order in tc.orders" >
<td ng-bind="order.id"></td> //It doesn't appear
<td>@{{ order.id }}</td> //It doesn't appear as well. I use Laravel, so I need to put @
</tr>
</table>
Below is the relevant script section:
angular.module('adminAngular', ['ui.bootstrap','dialogs.main'])
.controller('TableController', function(dialogs, $http){
var instance = this;
this.orders = [];
$http({
method : "POST",
url : "/admin/getOrders"
}).then(function (response) {
this.orders = response.data;
console.log("Inside; "+this.orders.length);
});
});
Despite seeing the data assigned to 'this.orders' in my console log, it does not display when using ng-repeat="order in tc.orders".
I sought assistance from this question, but it did not resolve the issue. I suspect that the problem may be related to the 'as' statement used in this situation.
Since there's limited information available about the 'as' syntax online, any advice would be greatly appreciated.