【问题标题】:ui-select with in multiple mode - how to implement reaction on click for the selected item?ui-select with in multiple mode - 如何实现对所选项目的点击反应?
【发布时间】:2016-06-13 16:32:07
【问题描述】:

我正在使用ui-select 选择多个项目。当我单击要打开的选定项目之一时modal window。我将它实现为 ui-select-match 元素中的 ng-click 函数。

<ui-select id="myselect" ng-model="myvar" theme="bootstrap" ng-required="true" multiple="" search-enabled="true" reset-search-input="true">
    <ui-select-match ng-click="myFunction()" placeholder="Click to select">{{$item}}
    </ui-select-match>
    <ui-select-choices repeat="item in ['one', 'two', 'three']">
      <div>{{item}}</div>
    </ui-select-choices>
  </ui-select>

我的 js 是这样的:

$scope.myFunction = function() {
  $uibModal.open({
   template: "Hi there!" 
  });
}

单击时,我的模态窗口正在打开,但我遇到了问题:当我通过单击 x 图标删除项目时,模态窗口打开。我怎样才能防止这种行为?

Plunkr 在这里:http://plnkr.co/edit/i4urNAa1u1rteXhfvAyd?p=preview

【问题讨论】:

    标签: css angularjs angularjs-ng-click ui-select angular-ui-select


    【解决方案1】:

    尝试在 ui-select-match 中移动 ng-click:

      <ui-select-match placeholder="Click to select">
        <a ng-click="myFunction()" > {{$item}} </a>
      </ui-select-match>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-03
    相关资源
    最近更新 更多