validation event to fire when duplicate chips not added

275 views Asked by At

When I try to add duplicate chips the component automatically delete the new added chip as it doesn't allow adding duplicated chips.

I need to fire an event which I can depend on to view a validation message for the user that he can't add duplicate chips


<div ng-controller="BasicDemoCtrl as ctrl" layout="column"
     ng-cloak="" class="chipsdemoBasicUsage" ng-app="MyApp">

  <md-content class="md-padding" layout="column">

     <h2 class="md-title">Make chips editable.</h2>

       <md-chips ng-model="ctrl.editableFruitNames" readonly="ctrl.readonly"
                 md-removable="ctrl.removable" md-enable-chip-edit="true"
                 input-aria-label="Fruit names">
       </md-chips>
       <em ng-if="if chips duplicated(the condition which I need)">You have 
        added a duplicated chip</em>

try to add duplicate chips .. the duplicated one will be automaticlly deleted without any validation message https://codepen.io/aRagabCs/pen/OYXwEx

0

There are 0 answers