Using Angular 6, I want to concat Firstname and Lastname in bindLabel inside ng-select tag ?
Here is my html : ng-select [items]="persons" bindLabel="LastName" bindValue="Id" [(ngModel)]="selectedItem" placeholder="person"
Any idea ? bindLabel="LastName + ' ' +FirstName" => doesn't work bindLabel="person.Name as (person.LastName + ' ' person.FirstName) for person in persons" => doesn't work
A better way for display the full name is:
<ng-select required [items]="buddies" bindLabel="firstName" #buddiesInput="ngModel" [(ngModel)]="userSelect" name="userSelect" >
<ng-template ng-label-tmp let-item="item">
{{item.firstName}} {{item.lastName}}
</ng-template>
<ng-template ng-option-tmp let-item="item" let-search="searchTerm">
{{item.firstName}} {{item.lastName}}
</ng-template>
</ng-select>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With