product-crud | Workshop application Practical Forms with Symfony | Functional Programming library
kandi X-RAY | product-crud Summary
kandi X-RAY | product-crud Summary
Workshop application "Practical Forms with Symfony"
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Configure the container .
- Register the bundles .
- Configure the routes .
- Get project directory .
product-crud Key Features
product-crud Examples and Code Snippets
Community Discussions
Trending Discussions on product-crud
QUESTION
I am fairly new to angular and just implementing CRUD operations. I am using a express server which uses mongoose for my back-end and front-end is angular.
My express server is working fine I can do all requests and I can get the list of products to display in my angular application.
When I click on a product or try to delete a product I get the "Cannot read property of type '_id' of undefined"
My question is how can I define the specific product I clicked or deleted using their ID as that is what is needed for the delete request or where am I going wrong here? I dont really understand the undefined error either as I can get all the products and display their id, name brand ect..
I am using _id in my product model and isbn because the id created in postman uses _id which is the one I need in order to delete.
Here's my product service
...ANSWER
Answered 2021-Mar-23 at 18:29Looking at the functions you have in the component, the following changes should make it work.
Here product is a local variable which you need to pass.
Also, the function signature
deleteProduct(product.id)
and function calls(click)="deleteProduct(product.id)"
do not match.
You might want to change these to something like, (click)="deleteProduct(product._id, product)"
. Similarly check and modify other function calls.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install product-crud
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page