Using ui-tagging with one choice

I am new to angularjs and angular -ui, and I am having a problem with the ui-select module. I need to select one item from the list, and if there is no value, the user can add it manually, but the ui-select doen't tag system works for one value, and I don’t know why.

This is the ui selection code:

<ui-select tagging="tagStation" tagging-label="(Add station)" ng-model="new.station">
  <ui-select-match placeholder="Choose or Add">{{$select.selected.label}}</ui-select-match>
   <ui-select-choices repeat="station.value as station in stationList | filter: { label: $select.label }">
    <div ng-bind-html="station.label | highlight: $select.search"></div>
   </ui-select-choices>
 </ui-select>

And this is the function for the tagging attribute:

$scope.tagStation = function (newTag) {
            var item = {
                label: newTag,
                value: 0
            };

            return item;
        };

Can someone help me? thank

+4
source share
1 answer

, . , tagging-label="false". , ! , , , , , , - .

+2

Source: https://habr.com/ru/post/1599859/


All Articles