<select [(ngModel)]="perPage" (change)="onGridPageLenthChange($event.target.value)" class="form-control form-control-sm">
<option *ngFor="let lenghtChangeItem of lengthChangeMenu" value={{lenghtChangeItem.valueField}} >
{{lenghtChangeItem.displayField}}
</option>
</select>
in compoent
perPage:any;
lengthChangeMenu:any[];
[(ngModel)]="perPage" For default selected
'lengthChangeMenu':[
{
displayField:5,
valueField:5
},
{
displayField:10,
valueField:10
},
{
displayField:25,
valueField:25,
selected:true
},
{
displayField:50,
valueField:50,
selected:true
},
{
displayField:100,
valueField:100,
selected:true
}
],
Create dropdown dynamic in Angular 2
Create select in ngfor in Angular 4
set default value in Angular 6
No comments:
Post a Comment