Javascript select中的ng change指令工作不正常

Javascript select中的ng change指令工作不正常,javascript,html,angularjs,angularjs-directive,Javascript,Html,Angularjs,Angularjs Directive,我有一个选择输入和一个函数,当选择的值被更改时调用该函数。使用键盘箭头键更改值时,模型不会更新(第一次)。 有人能告诉我为什么吗 JS: HTML: <div ng-controller="mainController"> <!-- If you change the value with the arrows ng-change doesn't work on the first change. --> <select ng-model="sel

我有一个选择输入和一个函数,当选择的值被更改时调用该函数。使用键盘箭头键更改值时,模型不会更新(第一次)。 有人能告诉我为什么吗

JS:

HTML:

<div ng-controller="mainController">
    <!-- If you change the value with the arrows ng-change doesn't work on the first change. -->
    <select ng-model="selected" ng-options="person.name for person in people track by person.id" ng-change="selectionChanged()"></select>

    <span>{{selected}}</span>    
</div>

{{selected}}

提前感谢。

您希望对选择元素进行自动对焦,以便它从第一次开始。增加了选择自动对焦功能

代码已更改:

<select ng-model="selected" ng-options="person.name for person in people track by person.id" ng-change="selectionChanged()" autofocus></select>


这是一个已知的问题,事实上,仍然是一个悬而未决的问题。有几种方法可以让它按您所期望的方式工作。您可以在以下项目问题跟踪程序中阅读相关内容:。作为一种解决方法,您可以在
中放置一个空的
。观察以下变化

<select ng-model="selected" ng-options="person.name for person in people track by person.id" ng-change="selectionChanged()">
    <option value=""></option>
</select>


-更新的演示

在这里运行良好。。在mozila中,您必须按enter键才能进行更改,否则我将使用最新的chrome。在Edge中,它可以完美地工作。在firefox中,我需要按Enter键,就像你说的。在第一个按键-最新的Chrome上,这似乎仍然没有更新
<select ng-model="selected" ng-options="person.name for person in people track by person.id" ng-change="selectionChanged()">
    <option value=""></option>
</select>