我希望默认选择一个值。
这是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);
}
答案 0 :(得分:1)
在您的$unserialized = unserialize($row['meta_value']);
echo $unserialized['url']; // should produce "https://YOURLINK.COM/LINKMEHARD"
中,只需使用要默认选择的值初始化app.component.ts
:
selected