HTML
<tr ng-repeat="sale as examples">
<td class="text-right"> @{{sale.sales_person}}</td>
<td class="text-right"> @{{sale.sales_total}}</td>
<td class="text-right"> @{{sale.sales_target_amount}}</td>
<td class="text-right"> @{{sale.sales_target_total}}</td>
</tr>
JS
$scope.getMonthlySalesTarget = function () {
$scope.sales_target_loading = true;
bz_Dashboard.getMonthlySalesTarget($scope.sales_target.startdate, $scope.sales_target.enddate).then(function (data) {
$scope.sales_target.data = angular.copy(data);
$scope.examples = $scope.sales_target.data;
console.log($scope.examples);
}).finally(function () {
$scope.sales_target_loading = false;
});
};
我正在尝试使用 ng-repeat 加载,但我遇到了那个错误。 $scope.examples
将数据列表存储为。
杰森
[{"sales_total":"386.90","sales_target_amount":"30000.00","sales_person":"Tony","sales_target_total":29613.1}]
我怀疑错误是由数据访问问题触发的,所以我确实尝试将 $index 添加为 sale as examples by $index
但它不起作用。
最佳答案
尝试在 ng-repeat 中使用 'in' 而不是 'as'。
ng-repeat="示例中的销售"
关于javascript - ngRepeat :iexp Invalid Expression when render the data,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56470712/