For testing e.g. responsiveness of data tables, I would like to populate a data table with a lot of entries. Testing responsiveness is then done quickly using 'ng serve'.
How can I detect in an Angular app that the application was started using 'ng serve'?
I would like to show dummy data when the application is started using 'ng serve'.
This is especially useful when loading tables and quick-test functionality attached to data rows.
CodePudding user response:
I'd advise using json-server
(or a basic express
server) as a mock API to serve JSON
Then use Angular"s --proxy
feature to reroute any API calls to your mock server
This is the preferred/only approach I've seen anywhere I've worked. Defo don't hard code mock data into your application (especially if it's ever going to go into production)
There's a good discussion on this here: