Angular学习系列一:准备工作

1:下载nodejs : https://nodejs.org/en/  推荐稳定版本

2:  安装 angular CLI

因为angular-cli是用typescript写的,所以要先装这两个npm install -g typescript typings,安装方式如下2中:

安装方法一:
npm install -g @angular/cli

安装方法二:
npm下载很多国外的链接,我们国内访问可能很慢或者打开不了
需要用淘宝镜像安装:cnpm,每隔10分钟同步一次
先安装cnpm:  npm install -g cnpm --registry=https://registry.npm.taobao.org/
再去安装: cnpm install -g @angular/cli

 

3: 开发工具推荐

可使用:webstorm/vscode
下载webstorm http://www.jetbrains.com/webstorm/
下载vscode https://code.visualstudio.com/

4: 创建项目
ng new 你的项目名称

ng g component 组件文件夹目录
如: ng g component components/headers

ng g service 服务文件夹目录
如: ng g servie services/httpServices

运行该项目:

ng serve --open 

指定端口打开项目:

ng serve --port 8888 --open

原文地址:https://www.cnblogs.com/hanliping/p/12115608.html