javascript - How to detect user interaction in a directive -
hello want track action when user add new chips run save function
html :
<md-chips ng-model="contacts" md-autocomplete-snap=""> <md-autocomplete md-selected-item="selecteditem" md-search-text="searchtext" md-items="item in querysearch(searchtext)" md-item-text="item.name" placeholder="specify reviewer(s)"> <span md-highlight-text="searchtext">{{item.name}} {{item.email}}</span> </md-autocomplete> <md-chip-template> <span> {{$chip.email || $chip}}<br> </span> </md-chip-template> </md-chips>
js :
$scope.$watch('contacts', function(){ if ($scope.chip){ alert("hello") } })
use md-on-append
<md-chips md-on-append="newemail($chip)"... >
https://github.com/angular/material/tree/master/src/components/chips/demobasicusage
Comments
Post a Comment