Javascript 多次调用Select回调时的UI Select

Javascript 多次调用Select回调时的UI Select,javascript,jquery,angularjs,ui-select,Javascript,Jquery,Angularjs,Ui Select,我正在使用ui选择。而且在选择一个项目时需要调用一些方法。 这是我的密码 <ui-select ng-model="myCtrl.selectedPersonId" theme="bootstrap" close-on-select="true" title="Search Person by Id" name="personSearch" on-select="myCtrl.onPersonSelect(

我正在使用ui选择。而且在选择一个项目时需要调用一些方法。 这是我的密码

 <ui-select ng-model="myCtrl.selectedPersonId" 
         theme="bootstrap"  close-on-select="true"  
         title="Search Person by Id"
         name="personSearch" 
         on-select="myCtrl.onPersonSelect()">
     <ui-select-match allow-clear="true" placeholder="Search Person">
         {{$select.selected.name}}
     </ui-select-match>
     <ui-select-choices repeat="item.id as item in myCtrl.personsResult" 
             refresh="myCtrl.personSearch()"
             minimum-input-length="1" 
             refresh-delay="1000">
         <div ng-bind-html="item.name"></div>
         <small>
             name: {{item.name}}
         </small>
     </ui-select-choices>
 </ui-select>

{{$select.selected.name}
名称:{{item.name}
问题是select=“myCtrl.onPersonSelect()”上的回调方法被多次调用。当用户选择一个项目时,会调用该项目;当用户单击ui select并显示输入框以键入结果时,也会调用该项目。因此,对于一个选择,它会被调用2-3次。每当用户点击输入时,就会调用on select函数

这可能是因为从$http获取结果数据


有人能帮我一下吗。

你能做一把小提琴吗?因为你的代码看起来很好。你能做一把小提琴吗?因为你的代码看起来很好