默认情况下,选择标签选择一个值Angular Typescript

时间:2018-08-17 08:57:53

标签: angular typescript

我希望默认选择一个值。

这是stackblitz链接:https://stackblitz.com/edit/angular-lwculd

HTML部分:

<select [(ngModel)]="selected" (ngModelChange)="onSelect(selected)" class="form-control">

        <option selected="Select" *ngFor="let status of statuses" [value]="status">
          {{ status }}
        </option>
      </select>

TS部分:

 statuses = ['Select', 'Enable', 'Temporary Disable', 'Permanent Disable', 'Lock User', 'Auto Disable'];

  onSelect(val) {
    console.log(val);
  }

1 个答案:

答案 0 :(得分:1)

在您的$unserialized = unserialize($row['meta_value']); echo $unserialized['url']; // should produce "https://YOURLINK.COM/LINKMEHARD" 中,只需使用要默认选择的值初始化app.component.ts

selected