简体   繁体   English

每当我尝试在我的前端角度中调用_id参数时,我都会出错

[英]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.

相关问题 我正在尝试使用反勾来调出包含我的 ID 和密钥的 function。 但是我收到一个错误作为意外令牌 - I am trying to use back tick to call out a function that contains my id and key. But I am getting an error as Unexpected token 尝试将我的 API 部署到 heroku 时遇到此问题 - I am having this Issue when trying to deploy my API to heroku 我正在使用 heroku api 和 postgresql 数据库来存储书籍,但我无法让它在前端工作 - I am working on a heroku api with a postgresql database that stores books but I can't get it to work on the front-end 尝试运行我的机器人命令时出现此错误 - I am getting this error when trying to run my bot commands 添加到数据库时如何更新前端? - how to get my front-end updated when I add to my database? 我在尝试使用 npm 安装为我的克隆项目下载包时遇到错误 - i am having error trying to use npm install to download a packages for my cloned projects 我可以在前端看到风景吗? - can I have the view in the front-end? 我在更新状态时出现错误 - I am having an error while updating my states in react 如何在我从后端发送的前端返回 json 响应? - How to get the json response back in the front end that I am sending from my backend? 我正在学习 angular bootstrap,我正在尝试在我的机器上安装 npm。 它没有安装 - i am learning angular bootstrap, and i am trying to install npm on my machine. it is not getting installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM