1. 创建项目: ng new
ng new angular-demo
如果只想创建项目,而不安装依赖,可增加--skip-install参数。创建完成后,进入项目目录,执行npm install 或者 cnpm install来手动安装项目依赖。
ng new angular-demo --skip-install
2. 创建组件: ng g component 或者 ng generate component
ng g component components/home
或者
ng generate component components/home
3. 创建服务: ng g service
ng g service home
4. 创建模块: ng g module
ng g module app-routing --flat --module-app
启动项目: ng server --open