【问题标题】:why jquery-chosen not working inside tabs in angular-ui为什么 jquery-chosen 不能在 angular-ui 的选项卡中工作
【发布时间】:2014-07-18 07:30:27
【问题描述】:
<tabset  class="ui-tab">
    <tab heading="General Details">
      <select class="chosen chzn-done chosen-select">
          <option value=""></option>
          <option value="1">contains</option>
          <option value="2">does not contain</option>
          <option value="3">is equal to</option>
      </select>
    </tab>
</tabset>


 jQuery(document).ready(function () {
    jQuery(".chosen").chosen({
        no_results_text: "Oops, nothing found!",
        allow_single_deselect: true,
        width: "20%"
    });
});

这是我测试过的代码。此处选择的下拉菜单不起作用,但在 &lt;tabset&gt; 的外部正常工作。我应该如何解决这个问题?

【问题讨论】:

  • 你为什么不去选择角度?

标签: angularjs tabs angular-ui jquery-chosen


【解决方案1】:

角度方式是为jQuery插件创建指令。

我为您提到的 jquery-chosen 创建了一个简单的。这是plunker

var app = angular.module('app', ['ui.bootstrap']);

app.directive('chosen', function(){
  return {
    link: function(scope, element){
      element.chosen({
        no_results_text: "Oops, nothing found!",
        allow_single_deselect: true,
        width: "20%"
      });
    }
  };
});

编辑: 已经有一个库可以将 jquery-chosen 集成到 angularangular-chosen

【讨论】:

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