我想知道是否可以在配置文件中设置主机和端口,这样我就不必键入
ng serve --host foo.bar --port 80
与其只是
ng serve
我想知道是否可以在配置文件中设置主机和端口,这样我就不必键入
ng serve --host foo.bar --port 80
与其只是
ng serve
在最新版本的ANGLING中,该值设置为the angular.json
config file.示例:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"projects": {
"my-project": {
"architect": {
"serve": {
"options": {
"port": 4444
}
}
}
}
}
}
您还可以查看/编辑值:
ng config projects["my-project"].architect["serve"].options {port:4444}
在以前的版本中,这是defaults
元素下面的set in angular-cli.json
:
{
"defaults": {
"serve": {
"port": 4444,
"host": "10.1.2.3"
}
}
}