将ui-select值输入函数参数

时间:2018-03-13 11:47:03

标签: javascript angularjs json object ui-select

我想将ui select json数据绑定到另一个.form-group。

我想在ng-click功能中获取模型数据。

我的代码:

form(novalidate='', name='bookForm')
            .col-lg-12
              .col-lg-6
                .form-group
                  label.col-md-3.control-label(for='states') Customer
            .col-lg-12(style='margin-left:135px;margin-top:-41px;')
              .col-lg-6
                .form-group
                  ui-select(ng-model='model.selected',required)
                    ui-select-match(placeholder='Pick one...') {{$select.selected.fName}}
                    ui-select-choices(repeat='person in customers | filter: $select.search track by person.fName')
                      div(ng-bind-html='person.fName | highlight: $select.search')
                      div(ng-bind-html='person.email | highlight: $select.search')
                    ui-select-no-choice
                      | Dang!  We couldn't find any choices...

              .col-lg-2
                .form-group
                  h1 {{model.selected}}
                  button.pull-right.btn.btn-primary.waves-effect.waves-light( ng-disabled='bookForm.$invalid', value='Add to list',ng-click='getdata(model.selected)')
                    i.fa.fa-plus  
                    | New Ticket

我想将此{{$ select.selected.fName}}数据绑定到另一个.form-group

h1 {{$select.selected.fName}}

我想让这个成为一个对象

1 个答案:

答案 0 :(得分:0)

阅读The icons state image文档可以为您提供帮助。您可以向指令添加on-select属性,定义在用户选择选项时要调用的函数。这会将选定的$ item和$ model传递给定义的函数。

相关问题