简体   繁体   中英

Angular Material md-contact-chips autocomplete issue

I have a problem using the md-contact-chips autocompletion. I try to catch the $query as soon as anybody starts typing something.

HTML

<md-contact-chips
   ng-model="members"
   md-contacts="querySearch($query)"
   md-contact-name="fullname"
   md-contact-email="email"
   md-contact-image="image"
   filter-selected="true"
   md-require-match
   placeholder="Add members">
</md-contact-chips>

JS

$scope.querySearch = function($query) {
    console.log($query);
};

When I try to search for additional members (which all are in my $scope.members ) I get this JS error.

TypeError: $scope.textChange is not a function

I'm using Angular 1.4.1 and Material 0.10.0

You can use the workaround suggested on this page by norkunas .

Add md-selected-item-change="null" md-search-text-change="null" to the md-contact-chips element.

I had the same issue and couldn't figure out why. I downgraded my angularjs version to 1.3.15, which is what material.angularjs.org is using. And it works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM