如何使用angularjs处理令牌输入中的KeyUP事件

时间:2014-11-10 10:53:46

标签: javascript angularjs

i myself using the following tag in my html

<token-input id="{{input.name}}" data-lookup="{{input.name}}" data-tags="data[input.name]"  data-getlookup="lookupData(query,params)"  placeholder="" />

i want to get the result by pressing enter. But i am not able to use ng-keyup in the token-input tag. I need help regarding this

 ngModule.directive('tokenInput', function(){
    return {
        restrict: 'E',
        replace: true,
        transclude: true,
        scope: {
            id:'@',         // element id
            lookup: '@',    // categorys to get lookup results for
            tags: '=',      // two-way binding between controller and directive for selected tags
            options: '=',   // allows override of default options
            getlookup: '&'  // function to get lookup data based on query
        },
        template: '<input type="hidden" id="{{id}}" name="{{id}}" ng-model="tags" class="" ui-select2="displayOptions" />',
        controller: ['$scope' , function($scope) {
var params = {
                query: '',
                start: 1,
                rows: 10
            };
//apply custom options
            if(angular.isDefined($scope.options) && angular.isObject($scope.options)){
                angular.extend($scope.displayOptions,$scope.options);
            }    
        }]
    };
});
};

这是我的指令,我必须处理密钥功能 我甚至无法使用ng-keyup 有没有办法处理

0 个答案:

没有答案