Html 选择angularjs的标记
我试着在angularJS中填充一个select,但它不起作用,我不明白为什么。 因此,在我的控制器中,我使用http请求填充历史对象的cShops属性。我在属性上使用Console.Dir来显示内容,我的变量填充得很好。所以我试着用这个对象列表来填充我的select标签,但它不起作用,我在chrome控制台中也没有错误 方法获取包含店铺列表的属性的历史记录:Html 选择angularjs的标记,html,angularjs,select,Html,Angularjs,Select,我试着在angularJS中填充一个select,但它不起作用,我不明白为什么。 因此,在我的控制器中,我使用http请求填充历史对象的cShops属性。我在属性上使用Console.Dir来显示内容,我的变量填充得很好。所以我试着用这个对象列表来填充我的select标签,但它不起作用,我在chrome控制台中也没有错误 方法获取包含店铺列表的属性的历史记录: var reqGetHistEmployees = $http({ url: 'api/Employees/GetHistoryEmpl
var reqGetHistEmployees = $http({ url: 'api/Employees/GetHistoryEmployee', params: { 'id': id } });
reqGetHistEmployees.success(function (resolve) {
$scope.histEmployee = resolve;
console.log('histEmployee[0].cShops : ');
console.dir($scope.histEmployee[0].cShops);
});
因此,当我核实清单时,商店里已经挤满了人。因此,我尝试在html中的select中显示此列表:
Affectations :
<table class="myTable">
<thead style="background-color:#54a0fc !important;">
<tr>
<th>{{'Shop' | i18n}}</th>
<th>{{'Function' | i18n}}</th>
<th>{{'Contract' | i18n}}</th>
<th>{{'Entrance' | i18n}}</th>
<th>{{'Ending' | i18n}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="hist in histEmployee">
<td><select ng-options="shop.Name for shop in hist.cShops track by shop.ShopID"></select></td>
<td>{{hist.FunctionName}}</td>
<td>{{hist.ContractName}}</td>
<td>{{hist.DateOfEntry | date:'shortDate'}}</td>
<td>{{hist.DateOfEnding | date:'shortDate'}}</td>
</tr>
</tbody>
</table>
但我的select是空的,并且控制台上没有错误,所以我不知道如何解决这个问题
提前感谢您为我提供的任何帮助您的select标记中缺少ng模型属性 看。如果我的提示不能解决你的问题,你可能会错过其他东西。阅读文档-这应该是一个简单的修复自己做 更新 我猜您还希望在选择时存储shops ID,并希望为用户显示名称 所以你需要做这样的事情: 选择作为数组中值的标签 您的选择:id 你的标签:姓名 你的价值:购物
您的数组:hist.cShops谢谢,我不知道select的第二种形式,它可以工作。