I have a dynamic json feeding options into a datalist. The options also include a value attribute that appears in the dropdown selection list. How can I remove this value from the selection? Any help is appreciated. Here's the code snippet:
home.component.html
<div>
<input type="text" list="codes">
<datalist id="codes">
<option *ngFor="let c of statusdata" [value]="c.id" >{{c.name}}</option>
</datalist>
</div>
home.component.ts
import { Component, OnInit } from '@angular/core';
import { CommonserviceService } from './../utilities/services/commonservice.service';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
declare var $: any;
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
statusdata: any;
ngOnInit() {
this.statusdata = [{ id: 1, name: 'Angular 2+' },
{ id: 2, name: 'Angular 4' },
{ id: 3, name: 'Angular 5' },
{ id: 4, name: 'Angular 6' },
{ id: 5, name: 'Angular 7' }
];
}
}