详情查看:https://www.angular.cn/guide/file-structure

app.module.ts

定义 AppModule, 这个根模块会告诉 Angular 如何组装该应用。 目前, 它只声明了 AppComponent。 稍后它还会声明更多组件

/*这个文件是Angular 根模块,告诉Angular如何组装应用*/

//BrowserModule,浏览器解析的模块
import { BrowserModule } from '@angular/platform-browser';
//Angular核心模块
import { NgModule } from '@angular/core';
//根组件
import { AppComponent } from './app.component';
import { NewsComponent } from './components/news/news.component';
import { HomeComponent } from './components/home/home.component';
import { HeaderComponent } from './components/header/header.component'; /*@NgModule装饰器, @NgModule接受一个元数据对象,告诉 Angular 如何编译和启动应用*/
@NgModule({
declarations: [ /*配置当前项目运行的的组件*/
AppComponent, NewsComponent, HomeComponent, HeaderComponent
],
imports: [ /*配置当前模块运行依赖的其他模块*/
BrowserModule
],
providers: [], /*配置项目所需要的服务*/
bootstrap: [AppComponent] /* 指定应用的主视图(称为根组件) 通过引导根AppModule来启动应用 ,这里一般写的是根组件*/
}) //根模块不需要导出任何东西, 因为其它组件不需要导入根模块
export class AppModule { }

最新文章

  1. 从AdventureWorks学习数据库建模——国际化
  2. MySQL查询优化之explain的深入解析
  3. [EmguCV|WinForm] 使用EmguCV內建直方圖工具繪製直方圖(Histogram)-直方圖(Histogram)系列 (1)
  4. NK3C开发要点
  5. ember.js:使用笔记9 开始单元测试
  6. ruby cookbook
  7. [弹出消息] C#ShowMessageBox帮助类
  8. HDU-2087 剪花布条
  9. 【转】windows上自动设置java环境变量的脚本
  10. jQuery带有定时器的tab栏切换
  11. 使用 Live555 搭建流媒体服务器
  12. 使用IPTABLES限制IP上传下载速度,如何用iptables限速?
  13. [USACO Dec06]产奶的模式
  14. THUPC2017 抱大腿记
  15. java 线程方法 ---- sleep()
  16. window.location.href 传参中文乱码问题!!!
  17. ssh无法访问服务器报“ssh-dss”认证错误
  18. Springboot学习笔记(三)-常用注入组件方式
  19. 已知一个函数rand7()能够生成1-7的随机数,请给出一个函数rand10(),该函数能够生成1-10的随机数。
  20. CentOS75 安装Oracle18c

热门文章

  1. ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
  2. Stock Exchange (最大上升子子串)
  3. React 之 render props 的理解
  4. Spring MVC框架及标签库
  5. pyharm 上运行 npm 配置方法
  6. 02-Elenment 引入使用
  7. Laravel - 解决连接MySQL时报"The server requested authentication method unknown to the client”错误
  8. Qt--解析Json
  9. 代码编辑器——Visual Studio Code
  10. luogu 3248