I have a view with an id in URL. When loading this view I call service and take all user data, looks similar to.
{
"code": 0,
"message": "",
"body": {
"id": 1,
"name": "test",
"profile": [
{
"id": 2,
"description": "admin"
},
{
"id": 1,
"description": "user"
}
]
}
}
Suppose that user doesn't have profiles, so select component only has all array data. In other case suppose that user has an admin profile, so select component has all array but admin is the default selected.
In HTML i have
<ng-select [multiple]="true" name="perfiles" placeholder="{{ 'profile-placeholder' | translate }}"
[(ngModel)]="perfiles">
<ng-option *ngFor="let perfil of perfiles" bindLabel="perfil.descripcion" [value]="perfil.id" >{{perfil.descripcion}}</ng-option>
</ng-select>
And the result is.
The problem is that component doesn't show any data. Apparently works, a user has two profiles, but I don´t know how show description. Any help?