Home  >  Article  >  Web Front-end  >  How should I learn Angular2?

How should I learn Angular2?

零下一度
零下一度Original
2017-06-27 10:04:041684browse

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

in http://localhost:4200
#下面步骤用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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn