5

I am in reference to AngularJS Material's md-autocomplete. See here for documentation.

I am new to Angular Material and I need a multiple value autocomplete (somewhat like the Tags control of Stackoverflow).

Is this possible with AngularJS Material's md-autocomplete?

Here is what I have attempted:

$scope.advertisement.languages = [];

$scope.chooseLanguages = function (input) {
    var deferred = $q.defer();
    languageService.languages(input, function (languages) {
        deferred.resolve(languages);
    });
    return deferred.promise;
};
<md-autocomplete
  md-no-cache="false"
  md-min-length="3"
  md-selected-item="advertisement.languages"
  md-search-text="searchLanguage"
  md-items="language in chooseLanguages(searchLanguage)"
  md-item-text="language.description"
  placeholder="spoken languages?">
  <span ng-repeat="lang in advertisement.languages" md-highlight-text="lang">{{lang.description}}</span>
</md-autocomplete>

Can someone please advise on what is wrong with my attempt to get the autocomplete to work with multiple selected values?

Edric
  • 24,639
  • 13
  • 81
  • 91
balteo
  • 23,602
  • 63
  • 219
  • 412
  • Hi @nitin! I have tried to get the md-autocomplete to work with multiple values to no avail... Can you please advise? – balteo Mar 20 '15 at 12:55
  • Also: what is the separator to be used bewteen the multiple values? And from where can I push the results in the array? – balteo Mar 20 '15 at 13:10
  • @nitin I definitely got stuck there... Can you please confirm that the md-autocomplete allows multiple values? – balteo Mar 27 '15 at 09:58
  • OK. Is there any plan to have it deal with mutliple values out of the box? – balteo Mar 27 '15 at 12:46
  • @nitin only 1 YEAR later, the link's content is already broken. This is why external links are bad and not really welcomed at stackoverflow :| – phil294 Jun 26 '16 at 22:25
  • use [md-chips](https://material.angularjs.org/latest/demo/chips). – mrmashal Jun 24 '17 at 13:19

0 Answers0