1、安装

  1. npm install -g @angular/cli
  1. //安装插件--vsCode有提示
  2. Angular Snippets (Version 8)

2、创建项目和启动项目

  1. //创建项目
  2. ng new my-dream-app
  3. //启动项目
  4. ng serve

3、vsCode创建组件

3-1、命令行生成(推荐)

  1. ng g component components/header
  1. //项目结构
  2. app.module.ts //根模块
  3. @NgModule({
  4. // 注册组件
  5. declarations: [
  6. AppComponent,
  7. HeaderComponent
  8. ],
  9. imports: [
  10. BrowserModule
  11. ],
  12. providers: [],
  13. bootstrap: [AppComponent]
  14. })
  15. export class AppModule { }

3-2、手动创建(需手动引入)

  1. //安装插件
  2. Angular Files

4、Angular引入ng-zorro-antd

ng-zorro

全局引入

  1. //vsCode命令行
  2. ng add ng-zorro-antd
  3. 主组件内容被清空,需在.html中重新引入子组件

5、看到所有vsCode命令行的命令

  1. ng g

a.png