Running and serving an Angular app lets you see your app in a web browser while you build it. It helps you test and check your work live.
Running and serving an Angular app
ng serve [options]
ng serve is the main command to run and serve your Angular app locally.
You can add options like --port to change the port or --open to open the browser automatically.
ng serve
ng serve --open
ng serve --port 4300This command starts the Angular development server and opens your app in the browser at http://localhost:4200. The server watches your files and reloads the app automatically when you save changes.
/* Run this command in your Angular project folder */
ng serve --openMake sure you run ng serve inside your Angular project folder where angular.json is located.
If port 4200 is busy, Angular will suggest another port or you can specify one with --port.
Use Ctrl + C in the terminal to stop the server when done.
ng serve runs your Angular app locally for testing and development.
You can customize the port and open the browser automatically with options.
The server reloads your app live when you save changes to your code.