How to capture double-click event in md-chip, using ng-dblclick?

516 views Asked by At

I'm looking for a way to capture double-click event, using ng-dblclick in md-chip directive.

but every-time I double click over the input field it gives me the following error. I suspect that it doesn't support ng-dblclick. enter image description here

Client side code

<md-chips ng-model="keyset3" 
          name="keyset3" 
          readonly="readonly"
          md-removable="removable"
          md-max-chips="5" 
          placeholder="Enter a Keyword..." 
          ng-dblclick="fieldDoubleClick('keyset3')">
    <md-chip-template>
        <strong>{{$chip}}</strong>
    </md-chip-template>
</md-chips>

Any help is greatly appreciated.

1

There are 1 answers

0
Tairman On BEST ANSWER

Earlier fieldDoubleClick Implementation

$scope.fieldDoubleClick = function(fieldName, type) {
    utils.setValue($scope,fieldName,utils.removeEscapeCharacters($scope.extractedData.text));                                 
}

New fieldDoubleClick Imp

$scope.fieldDoubleClick = function(fieldName, type) {


          if(type=="chip") {
              var arr = [];
              arr.push(utils.removeEscapeCharacters($scope.extractedData.text));
              utils.setValue($scope, fieldName, arr);
          } else {
              utils.setValue($scope, fieldName, utils.removeEscapeCharacters($scope.extractedData.text));                 
          }

      }

Solution - The model for the chip need to be an Array. (Provided by - Matthew Cawley)