Angular项目搭建

158 阅读1分钟

angular-cli 脚手架

npm i -g @angular/cli

npm i -g cnpm --registry=https://registry.npm.taobao.org
cnpm i -g @angular/cli

查看脚手架版本

ng version

image.png

创建项目

cd angular
ng new demo01 --skip-install
cd demo01
cnpm install

启动项目

ng serve

指定启动端口ng serve --port 4300

创建组件

ng g c

ng g s

项目打包

ng build