[英]I am having error when ever i am trying to call _id parameter in my angular front-end
EmployeeComponent.html: 11 ERROR TypeError: Cannot read property '_id' of undefined This is the error I am having when ever I try to call the id in my angular front-end EmployeeComponent.html:11错误TypeError:无法读取未定义的属性“ _id”这是我尝试在有角度的前端中调用id时遇到的错误
I have tried using ngIf but it still gives me error 我曾尝试使用ngIf,但仍然给我错误
Here I am having error 我在这里有错误
<div class="col s5" >
<form #employeeForm='ngForm'(ngSubmit)="onSubmit(employeeForm)">
<input type="hidden" name="_id" #_id="ngModel"[(ngModel)]="employeeService.selectedEmployee._id" class="col s5">
<div class="row">
<div class="input-field col s12">
<input type="text" name='name' #name='ngModel'[(ngModel)]="employeeService.selectedEmployee.name" placeholder="Enter Full name" class="input-field col s12" required>
<label >Name :
<label class="red-text">*</label>
</label>
</div>
</div>
According to your code of just Angular, their can be many possibilities. 根据您仅Angular的代码,它们可能有很多可能性。 One would be that your backend would not have sent you _id to you in frontend.
一种可能是您的后端不会在前端向您发送_id给您。 first just verify that you are getting the proper data
首先只要确认您获得了正确的数据
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.