localhost:4200和localhost:4200 / projectName之间的区别是什么?

时间:2018-06-05 02:03:37

标签: angular

我使用角度v6。当我运行ng server时。 localhost:4200/projectName可以打开项目。但是当我更新代码时它不会自动更新。

所以我想知道它是什么以及它的源代码在哪里?我没有使用ng build --prod

1 个答案:

答案 0 :(得分:0)

ng serve is a command provided by the Angular CLI.

The Angular CLI is a tool to initialize, develop, scaffold and maintain Angular applications. ng serve builds the application and starts a web server.

If you want to update and reload the DOM as soon as you update code and save the file use:-

ng serve --watch

And also if you want to specify the host and port from which you want to access your angular application use:-

ng serve --host 0.0.0.0 --port 4200