Linux command
ng-serve 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start development server
ng serve
Serve on specific port
ng serve --port [4200]
Serve and open browser
ng serve --open
Serve specific project
ng serve [project-name]
Serve with production config
ng serve --configuration=production
Serve with proxy
ng serve --proxy-config [proxy.conf.json]
说明
ng serve builds an Angular application and starts a development server. It watches for file changes and automatically rebuilds, with live reload updating the browser. This is the primary command for Angular development workflow.
参数
- --port _port_
- Port number.
- --open, -o
- Open in browser.
- --host _host_
- Bind address.
- --configuration _name_
- Build configuration.
- --proxy-config _file_
- Proxy configuration.
- --ssl
- Enable HTTPS.
- --watch
- Rebuild on changes (default).
- --live-reload
- Enable live reload.
FAQ
What is the ng-serve command used for?
ng serve builds an Angular application and starts a development server. It watches for file changes and automatically rebuilds, with live reload updating the browser. This is the primary command for Angular development workflow.
How do I run a basic ng-serve example?
Run `ng serve` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --port _port_ do in ng-serve?
Port number.