I am using angular2 as a front end in my html pages.I have a django project that uses postgresql. Which is the best approach to use the angular2 in the django project to connect to the django models and the database to perform basic operations(CRUD)like Read,Update etc?
Currently I need to fetch the data from the database dynamically. (e.g.If user clicks on the product from the product list then product details should be retrieved from the database and it is shown to the user)
Any advice or reference example link will be helpful.
Create REST api end points using Django (use DRF for standard REST api's or just use vanilla django to generate json response for the requests and call it REST api).
For ex: /product/:id
is the api end point you've created to fetch the details of a particular product in Django
Then use Angular to request throught those API's and get the responses and do whatever you want with that data.
For ex: make a get request to /product/1
to fetch the details of a product with PK = 1
when the user clicks that product.
Browse through Github for some inspiration.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments