Hi
I have below code . API has records but it shows no data
export class EmployeeService { constructor(private htpClient: HtpClient) { } getallEmployee(): Observable<any> { return this.htpClient.get('onlinetestapi.gerasim.in/api/TeamSync/GetAllEmployee'); }
import { Component,ViewChild,ElementRef,OnInit } from '@angular/core'; import { EmployeeService } from '../../service/employee.service'; import { FormBuilder,FormsModule, ReactiveFormsModule, FormGroup, FormControl, Validators } from '@angular/forms'; import { CommonModule } from '@angular/common'; @Component({ selector: 'app-employee', standalone: true, imports: [CommonModule, FormsModule,ReactiveFormsModule], templateUrl: './employee.component.html', styleUrl: './employee.component.css' }) export class EmployeeComponent implements OnInit { @ViewChild('myModal') model : ElementRef | undefined; employeeArray: any[] = []; objEmployee: any = { "empId":0, "empName": "", "empContactNo": "", "empEmail": "", "addressLine1": "", "addressLine2": "", "pinCode":"", "city": "", "state": "", "bankName":"", "iFSC": "", "accountNo":"", "bankBranch":"", "salary":0 } constructor(private empSrv:EmployeeService){} get f(){ return this.form.controls; } ngOnInit():void{ this.loadAllEmployee(); } loadAllEmployee(){ this.empSrv.getallEmployee().subscribe((res:any)=>{ this.employeeArray = res.data; }) }
Thanks