1-1 src文件夹

  1. src
  2. --app
  3. --app.component.css(css)
  4. --app.component.html(html)
  5. --app.component.ts(js)
  6. --app.module.ts // 项目的根模块(App.vue),告诉angular如何组装应用。

1-2 app.moudle.ts

  1. //app.module.ts 根模块
  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. + import {HttpClientModule} from '@angular/common/http'
  8. @NgModule({
  9. /* 配置(声明)当前项目运行依赖的组件 */
  10. declarations: [
  11. AppComponent
  12. ],
  13. /* 配置当前项目运行依赖的其他模块 */
  14. imports: [
  15. BrowserModule,
  16. + HttpClientModule
  17. ],
  18. /* 配置项目所需要的服务 */
  19. providers: [],
  20. /* 指定应用的主视图 */
  21. bootstrap: [AppComponent]
  22. })
  23. /* 通过导出AppModule这个模块,来启动应用 */
  24. export class AppModule { }
  1. //安装插件
  2. Angular