角度范围更新不会更新html列表

时间:2015-12-08 08:10:24

标签: angularjs

我有这个代码来创建一个列表:

    <tr class="customer-row" ng-repeat="customer in Customers" id="{{customer.CustomerId}}" ng-mouseover="getUsers(customer.CustomerId)">
            <td class="col-xs-1">{{customer.CustomerId}}</td>
            <td class="col-xs-6">{{customer.CustomerName}}</td>
            <td class="col-xs-1">{{customer.CountryCode}}</td>
            <td class="col-xs-1">{{customer.CustomerERPId}}</td>
            <td class="col-xs-1"><i class="fa fa-wrench"></i></td>
        </tr>

我使用此代码执行此操作:

 $http.post("/User/GetBy?customerId=" + customerId)
     .then(function (response) {
         $scope.Users = response.data;
     });

当下拉列表发生变化时会触发此操作。

我还有一个文本框,我希望用户搜索客户,所以我有一个ng-keyup事件,最终会在这里结束。

 $http.post("/Customer/SearchCustomers?supplierId=" + $('#supplier').val() + "&searchText=" + $('#search-btn').val())
            .then(function (response) {
                console.log(response.data);
                $scope.Customers = response.data;
            });
    }

我获取所有用户并将其添加到范围内的客户。 这是我第一次在角度做任何事情但我被告知当我更新范围它应该更新html。 那个列表不应该更新吗?或者我必须触发一些东西来更新我的列表?

0 个答案:

没有答案
相关问题