Hiển thị các bài đăng có nhãn ngModel. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn ngModel. Hiển thị tất cả bài đăng

How to use select/option/NgFor on an array of objects in Angular2

Source: https://stackoverflow.com/questions/33181936/how-to-use-select-option-ngfor-on-an-array-of-objects-in-angular2

I don't know what things were like in the alpha, but I'm using beta 12 right now and this works fine. If you have an array of objects, create a select like this:
<select [(ngModel)]="simpleValue"> // value is a string or number
    <option *ngFor="#obj of objArray" [value]="obj.value">{{obj.name}}</option>
</select>
If you want to match on the actual object, I'd do it like this:
<select [(ngModel)]="objValue"> // value is an object
    <option *ngFor="#obj of objArray" [ngValue]="obj">{{obj.name}}</option>
</select>

Renewing Facebook Graph API token automatically?

  Mã truy cập dài hạn https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/ https://community.n8n.io/t/re...