数据表未在 angularjs 中重新加载

San*_*ana 5 asp.net-mvc angularjs angular-datatables

我有一个要求,我必须将特定产品添加到数据表并重新绑定数据表,以便更新其计数。我正在使用 MVC 和 angularjs 1.6.2

我正在创建数据表如下:

<table id="dtProducts" ng-if="AllProducts"
       class="table manage-user-table offer-mgt-table market-selection-tab"
       datatable="ng" dt-options="dataTableOpt">
    <thead>
        <tr>
            <th><input type='checkbox' class="selectAllMarket" 
                       value='SelectAll' ng-model="selectAll" >
            </th>
            <th>Product Name</th>
            <th>Product Type</th>
        </tr>
    </thead>
    <tbody>
        <tr dt-rows ng-repeat="product in AllProducts">
            <td><input type="checkbox" class="selectMarket"
                       ng-model="product.selected"
                       data-offerid="{{product.ID}}"
                       ng-click="toggleSelect(product.selected, $index)">
            </td>
            <td>{{product.Name}}</td>
            <td>{{product.VerticalType.VerticalTypeDisplayName}}</td>

        </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

视图上有一个部分,其中包含一个用于获取产品名称的文本框和一个用于获取产品类型的下拉列表。它还包含一个Add单击按钮的按钮,在服务器上点击一个帖子以保存该产品以及该帖子的成功在前端,我调用函数来重新加载AllProducts. 一旦调用该函数,我就会收到错误消息

TypeError: o.ngDestroy 不是 angularjs 数据表中的函数。

将产品保存到表中后,通过以下代码完成数据表的重新加载

var getAllProducts = function () {
    var urlgetAllProducts = apiURL + "/AllProducts?providerId=" + providerID;
    $http({
        url: urlgetAllProducts,
        method: 'GET', //$scope.customization,
    }).then(function successcallback(response) {

        $scope.AllProducts = response.data.ResponseData;


        $scope.$parent.AllProducts = $scope.AllProducts;
        if ($scope.offer.ProductList != undefined) {

            MakeSelected();
            $scope.selectProducts();

        }

    },
    function errorcallback(response) {
    }).then(function () {
    });
}
Run Code Online (Sandbox Code Playgroud)

任何人都可以在这方面帮助我吗?我正在使用 angulardatatables 0.6.2。如果需要,我可以提供更多详细信息。谢谢