如何在角度选择选择中获得关键事件的值

时间:2015-09-10 05:45:28

标签: javascript jquery angularjs angular-chosen

我使用角度选择选择,名为localytics.directives模块,我想在此选择输入中设置一个关键事件,我该如何获得此值?谢谢!

       <select chosen
                  ng-change="vm.fixItem(matchedLevel,unresolved)"
                  disable-search="false"
                  ng-model="matchedLevel"
                  ng-options="matchedLevel as matchedLevel.Name for
                  matchedLevel in level.allLevelItems">
      </select>

1 个答案:

答案 0 :(得分:0)

在您选择的指令链接器函数

中尝试此代码
$(".chosen-container").unbind('keyup').bind('keyup',function(e) {
                    //console.log('sfddf');
                    var searchStr = $('.chosen-container .search-field input').val();
                    console.log(searchStr);
                });