Angularjs 使用dropdownlist的ng更改上的ng repeat将数据绑定到表
我希望数据根据所选值显示在表中。当触发dropdownlist的ng更改时,我希望在获取数据后将数据绑定到表Angularjs 使用dropdownlist的ng更改上的ng repeat将数据绑定到表,angularjs,ajax,Angularjs,Ajax,我希望数据根据所选值显示在表中。当触发dropdownlist的ng更改时,我希望在获取数据后将数据绑定到表 <div ng-app="myapp" ng-controller="prodctrl" > <select id="BrandDropdown" class="InstanceList" ng-change="GetBrandProd()" ng-model="Products"> <option>Select Brand<
<div ng-app="myapp" ng-controller="prodctrl" >
<select id="BrandDropdown" class="InstanceList" ng-change="GetBrandProd()" ng-model="Products">
<option>Select Brand</option>
@if (ViewBag.dataset != null)
{
foreach (string str in (string[])ViewBag.dataset)
{
<option value='@str.Split('/')[0]'>@str.Split('/')[1]</option>
}
}
</select>
<table ng-model="Products">
<tr ng-repeat="P in Products track by $index">
<td >{{x.Id}}</td>
<td >{{X.Rank}}</td>
<td >{{x.Name}}</td>
</tr>
</table>
</div>
我能够成功地在response.records中获取数据。但在我得到数据后,什么也没发生
var app = angular.module('myapp', []);
app.controller('prodctrl', function ($scope, $http) {
$scope.GetBrandProd = function () {
var Id = $('#BrandDropdown').val();
$http({
method: "GET",
url: "/Home/GetProdBrand",
params: {
id:Id
}
})
.success(function (response) {
$scope.Products = response.records;
});
}
})