【问题标题】:How to change value of one autocomplete depending on another autocomplete in angular2如何根据angular2中的另一个自动完成更改一个自动完成的值
【发布时间】:2017-08-24 15:10:03
【问题描述】:

我如何创建两个自动完成取决于另一个自动完成。 我已经尝试过我的代码如下所示

<div class="col-md-4 xs-p1">
                        <div class="form-group">
                            <label>City <em>*</em></label>
                             <input ng2-auto-complete [(ngModel)]="contact.pCity" [source]="citySuggestions.bind(this)"
                                list-formatter="pCity" display-property-name="pCity" placeholder="Search by City"
                                class="form-control1" style="border-radius:0px">
                            <!--<input class="form-control1" id="height2" placeholder="Enter City" type="text" [(ngModel)]="contact.pCity">-->
                        </div>

                    </div>
                    <div class="col-md-4 xs-p1">
                        <div class="form-group">
                            <label>State <em>*</em></label>
                            <input ng2-auto-complete  [(ngModel)]="contact.pState" [source]="codeSuggestions.bind(this)"
                                list-formatter="pState" display-property-name="pState" placeholder="Search by State"
                               class="form-control1" style="border-radius:0px" (valueChanged)="getCitySuggestions($event)" max-num-list="5">
                        </div>
                    </div>

这没用,请帮忙。这个有链接吗

【问题讨论】:

    标签: angular autocomplete


    【解决方案1】:

    能否提供 getCitySuggestions 功能?
    .bind(this) 是不必要的

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-31
      • 1970-01-01
      • 1970-01-01
      • 2018-06-28
      • 2022-10-23
      • 1970-01-01
      相关资源
      最近更新 更多