To install the environment, you first need to install cli. Remember to install it globally
#angular cli安装 npm install -g angular-cli
After cli is installed, we can use the instructions starting with ng (just understand it as npm) ), create the project below
#安装相关项目包,具体包package.json里的dependencies和devDependencies有体现 #下面步骤用npm install也可以 ng init
After the package is installed, we can start our project. After execution, we can open
#下面步骤用npm start也可以 ng serve
If you want to open multiple projects for colleagues, you can modify the project port number
#修改默认端口4200 -> 修改为(3000) ng serve --port 3000 或 ng serve -p 3000
There is also a method to modify the project port but it is not recommended
Project directory \node_modules\angular-cli\lib\config\schema.json
#Change "default": 4200 in server to "default": 3000
Last package release
ng build
The above is the detailed content of How should I learn Angular2?. For more information, please follow other related articles on the PHP Chinese website!