How to create a custom dropdown in angular and load data
<select dropdown name="mydropDown" class="form-control dropdown-toggle">
<option *ngFor="let item of testList" [value]="item.value">
{{item.name}}
</option>
</select>
How to create a custom dropdown in angular and load data
<select dropdown name="mydropDown" class="form-control dropdown-toggle">
<option *ngFor="let item of testList" [value]="item.value">
{{item.name}}
</option>
</select>
Try this!
In component ts
export class TestComponent implements OnInit {
testList = [{ value: '1', name: 'A' }, { value: '2', name: 'Test B' }];
constructor() { }
ngOnInit(): void {
}
}
In component html
<select dropdown name="mydropDown" class="form-control dropdown-toggle">
<option *ngFor="let item of testList" [value]="item.value">
{{item.name}}
</option>
</select>