Javascript 用户界面选择第一项消失
此处的示例plunk: 我正在使用angular ui select,问题是当我从列表中选择第一个元素时,它会消失 在我的html中选择:Javascript 用户界面选择第一项消失,javascript,angularjs,ui-select,Javascript,Angularjs,Ui Select,此处的示例plunk: 我正在使用angular ui select,问题是当我从列表中选择第一个元素时,它会消失 在我的html中选择: <ui-select ng-model="person.selected" theme="bootstrap" search-enabled="false"> <ui-select-match>{{$select.selected.name}}</ui-sele
<ui-select ng-model="person.selected" theme="bootstrap" search-enabled="false">
<ui-select-match>{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="person in people">
<span ng-bind-html="person.name"></span>
</ui-select-choices>
</ui-select>
在本例中:
您能再解释一下代码应该做什么吗?在示例中,您可以看到当您从列表中选择“First”时,它将消失,并且您不能再次选择那个人。它应该保留在select上,更改后仍然可以选择,但事实并非如此。github@Yuri上有一个问题,谢谢。通过将
更改为
app.controller('ctrl', function ($scope, $http){
$scope.people=[
{ id: 1, name: "First" },
{ id: 1, name: "Second"},
{ id: 1, name: "Third"}
];
$scope.person = {};
$scope.person.selected = $scope.people[0];
});