How to structure CRUD routes correctly in Angular projects? How to structure CRUD routes correctly in Angular projects? angular angular

How to structure CRUD routes correctly in Angular projects?


The only conventions/best-practices regarding Angular that I'm aware of come from the official Style guide, it doesn't mention anything about routes. But definitely a recommended/good read.

Personally I would put 'create' and 'edit' into another module with a different root url.

admin/product/listadmin/product/edit/:idadmin/product/create

Else I'd use a slightly modified version of your Option 1.

List: /productsCreate: /products/createUpdate: /products/edit/:idRead: /products/:id

Clean and easy to read code > "beauty" of the URLs


For CRUD apps, I don't like all file path style. Instead, I would prefer use additional parameters for actions.

enter code hereList: /productsCreate: /products/;action=newUpdate: /products/123456;action=changeRead: /products/123456;action=display

Please refer my lengthy blog on how to build real CRUD app: https://vincezk.github.io/Portal/