1. //官网
  2. https://www.angular.cn/

安装

  1. npm install -g @angular/cli
  2. ng --version

创建应用

  1. ng new xxx

启动

  1. ng serve npm start
  1. 目前只需要关注
  2. src
  3. --app
  4. --app.module.ts // 项目的根模块(App.vue),告诉angular如何组装应用
  1. //Angular 的核心模块
  2. import { NgModule } from '@angular/core';
  3. // 浏览器解析模块
  4. import { BrowserModule } from '@angular/platform-browser';
  5. // App组件
  6. import { AppComponent } from './app.component';
  7. @NgModule({
  8. // 配置(声明)当前项目运行依赖的组件
  9. declarations: [
  10. AppComponent
  11. ],
  12. // 配置当前项目运行依赖的其他模块
  13. imports: [
  14. BrowserModule
  15. ],
  16. // 配置项目所需要的服务
  17. providers: [],
  18. // 指定应用的主视图
  19. bootstrap: [AppComponent]
  20. })
  21. // 通过导出AppModule这个模块,来启动应用
  22. export class AppModule { }