相关疑难解决方法(0)

角度ui-select标记在模糊时丢失文本输入

情况

大家好!我正在为我的应用程序使用Angular ui-select,以便从数据库中选择用户.如果用户不在列表中,则可以使用标记输入新条目.

通过写入名称并按ENTER或TAB,新条目将保存为新标记.

一切都工作得很好,除了一件小事:如果我用鼠标集中注意力,我会输入我输入的输入,这对用户不太友好.

<h3>Array of objects</h3>
<ui-select multiple tagging tagging-label="new tag" ng-model="multipleDemo.selectedPeople" theme="select2" ng-disabled="disabled" style="width: 800px;">
  <ui-select-match placeholder="Select person...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match>
  <ui-select-choices repeat="person in people | propsFilter: {name: $select.search, age: $select.search}">
    <div ng-bind-html="person.name | highlight: $select.search"></div>
    <small>
      email: {{person.email}}
      age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
    </small>
  </ui-select-choices>
</ui-select>
<p>Selected: {{multipleDemo.selectedPeople}}</p>
Run Code Online (Sandbox Code Playgroud)

PLUNKER

http://plnkr.co/edit/7fSAKmj3pLeeTaid4pMH?p=preview

如何设置将输入文本保存为新标签,不仅可以通过按ENTER,还可以通过鼠标聚焦?

非常感谢你!

javascript angularjs angular-ui ui-select

6
推荐指数
1
解决办法
1988
查看次数

标签 统计

angular-ui ×1

angularjs ×1

javascript ×1

ui-select ×1