AngularJS下拉选择问题

时间:2017-12-01 06:48:10

标签: html angularjs

我对Angular.JS格式的下拉列表有疑问。

我应该在下拉菜单下显示选项,即"更新"和"删除"。不幸的是,它没有显示任何内容。

<ui-select ng-model="ctrl.OptionChoices" title="Update or Delete">

<ui-select-match placeholder="Choose the option for the item">{{select.option.name}}</ui-select-match>

<ui-select-choices repeat="existingUOMx.UnitOfMeasurementID as existingUOMx in ctrl.existingUOMsx | filter: $select.search">

<small ng-bind-html="existingUOMx.UnitOfMeasurementID | highlight: $select.search"> - </small>

<span ng-bind-html="existingUOMx.Description | highlight: $select.search"></span>

</ui-select-choices>

</ui-select>

选项-menu.js

app.controller('myCtrl', function $scope) {

var option = this;
$scope.optionChoice = 0; // choice int are 0
$scope.toggleOption = true;
$scope.option = [
    { name: "Update" },
    { name: "Delete" }, 

]

感谢您的帮助

1 个答案:

答案 0 :(得分:2)

您可以像这样使用绑定下拉值

<select>
<option>Choose the option for the item</option>
  <option ng-repeat="ItemsPerPageCount in option" value="{{ItemsPerPageCount.name}}" ng-bind="ItemsPerPageCount.name"></option>
</select>