Angular 在“选择”菜单中添加所选项目的列表

Angular 在“选择”菜单中添加所选项目的列表,angular,angular6,angular-components,Angular,Angular6,Angular Components,我发现这个角度搜索菜单的很好的例子 <ui-select ng-model="ctrl.person.selected" theme="bootstrap"> <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match> &l

我发现这个角度搜索菜单的很好的例子

          <ui-select ng-model="ctrl.person.selected" theme="bootstrap">
            <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match>
            <ui-select-choices repeat="item in ctrl.people | filter: $select.search">
              <div ng-bind-html="item.name | highlight: $select.search"></div>
              <small ng-bind-html="item.email | highlight: $select.search"></small>
            </ui-select-choices>
          </ui-select>

{{$select.selected.name}


我想扩展这个示例,并从选择菜单中添加一个所选项目的列表。您能帮我实现这个功能吗?

下面的代码将使您的下拉菜单多选,并显示下拉菜单中选择的值列表

 <body class="ng-cloak" ng-controller="DemoCtrl as ctrl">
      Selected:<p ng-repeat="item in ctrl.person.selected"> {{item.name}}</p>

      <form class="form-horizontal">
        <fieldset>
          <legend>ui-select inside a Bootstrap form</legend>    
          <div class="form-group">
            <label class="col-sm-3 control-label">Default</label>
            <div class="col-sm-6">    

              <ui-select ng-model="ctrl.person.selected" theme="bootstrap" multiple="true">
                <ui-select-match placeholder="Select or search a person in the list...">{{$item.name}}</ui-select-match>
                <ui-select-choices repeat="item in ctrl.people | filter: $select.search">
                  <div ng-bind-html="item.name | highlight: $select.search">
                  </div>                  
                  <small ng-bind-html="item.email | highlight: $select.search"></small>
                </ui-select-choices>
              </ui-select>

            </div>
          </div>        
        </fieldset>
      </form>
    </body>

选中:

{{item.name}

在引导表单中选择ui 违约 {{$item.name}
ui选择库为启用多个选择提供多个属性


希望这能有所帮助。

请清楚地解释问题,否则您只会被拒绝问题是如何在“选择”菜单下添加所选项目的列表?@PeterPenzov我认为您应该查看您的问题标签,因为根据代码,您使用的AngularJS与AngularJS非常不同。您的意思是从下拉列表中选择多个值吗?是的,您能给我举个例子吗?