Ramco Ramco

Ramco Ramco

  • 443
  • 3.4k
  • 533.7k

Display list of names in option tag

May 27 2024 7:12 AM

Hi

  How to display list of names . I am trying like below

<div class="col-md-6">

                    <label for="empName" class="form-label">Name</label>

                    <option @for ("let item of attendanceArray" [value]="empId")>{{empName}}</option> >

                </div>

<form [formGroup]="form" > 
          <div class="modal-body">
            <div class="form-group" class="row g-3">
                <div class="col-md-6">
                    <label for="empName" class="form-label">Name</label>
                    <option @for ("let item of attendanceArray" [value]="empId")>{{empName}}</option> >
                </div>
</div>
</form>
form = new FormGroup({
    empId:  new FormControl(0),
    empName: new FormControl(''),
    empContactNo: new FormControl(''),
    attendanceId:  new FormControl(0),
    attendanceDate: new FormControl(''),
    inTime: new FormControl(''),
    outTime: new FormControl(''),
    isFullDay: new FormControl('')
  });
    
  get f(){
    return this.form.controls;
  }

 

  getEmployee(){
      this.empSrv.getallEmployee().subscribe((result: any)=>{
      this.employeeArray = result.data;
    })
  }

Thanks


Answers (3)