【问题标题】:Autocomplete materialize, search, filter. Angular [closed]自动完成物化、搜索、过滤。角[关闭]
【发布时间】:2018-07-11 12:49:45
【问题描述】:

在下面的代码中,我想使用 search inside 选项,比如自动完成。我该怎么做?

  <div class="row">
        <div class="input-field col s12">
          <select formControlName="sensorType_id" id="sensorType_id" materialize="material_select" [materializeSelectOptions]="sensorstype">
            <option value="" disabled selected>Select Sensor Type</option>
            <option *ngFor="let sensortype of sensorstype" [value]="sensortype.sensorType_id">{{sensortype.sensordescription}}</option>
          </select>
        </div>
      </div>

【问题讨论】:

    标签: html angular typescript autocomplete materialize


    【解决方案1】:

    你可以这样做

    <div class="row">
            <div class="input-field col s12">
                <md-input-container class="full-width">
                    <input mdInput placeholder="Location *" [mdAutocomplete]="autoSensore"
                           #searchLocation
                           formControlName="sensorType"
                           (keyup)="onChangeLocationName()">
                </md-input-container>
                <md-autocomplete #autoSensore="mdAutocomplete">
                    <md-option
                            *ngFor="let sensortype of sensorstype | search: searchLocation.value"
                            [value]="sensortype.sensordescription"
                            (onSelectionChange)="onSelected($event.source.selected, sensortype.id)">
                        {{ location.name }}
                    </md-option>
                </md-autocomplete>
            </div>
        </div>
    

    您还需要创建搜索管道

    【讨论】:

      猜你喜欢
      • 2022-10-24
      • 1970-01-01
      • 2021-02-05
      • 2014-09-16
      • 2021-02-05
      • 2020-06-20
      • 2016-09-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多