MatChipList选项卡导航

时间:2018-09-14 17:25:07

标签: angular-material

我有一个mat-form-field,其中包含一个芯片列表,另一个包含任何其他类型的输入。我希望能够从芯片列表导航到输入字段和以下mat-form-fields,但似乎不支持此行为。有没有人可以解决这个问题,以便可以使用tab浏览该组件?

<mat-form-field class="example-chip-list">
  <mat-chip-list #chipList>
    <mat-chip *ngFor="let fruit of fruits" [selectable]="selectable"
             [removable]="removable" (removed)="remove(fruit)">
      {{fruit.name}}
      <mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
    </mat-chip>
    <input placeholder="New fruit..."
           [matChipInputFor]="chipList"
           [matChipInputSeparatorKeyCodes]="separatorKeysCodes"
           [matChipInputAddOnBlur]="addOnBlur"
           (matChipInputTokenEnd)="add($event)">
  </mat-chip-list>
</mat-form-field>
<mat-form-field>
  <input placeholder="Another unrelated field" matInput>
</mat-form-field>

示例:https://stackblitz.com/edit/angular-ixswwc?file=app/chips-input-example.html

1 个答案:

答案 0 :(得分:1)

焦点无限循环的发生是因为if let jbEmail = userDefaults.string(forKey: "JBemail_preference") { // Do something with jbEmail } else { // There is no value, do something else } <input>