zoukankan      html  css  js  c++  java
  • angular项目目录结构分析

    详情查看: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 { }

     

  • 相关阅读:
    Python该怎么学?
    Python招聘需求
    最短路合集
    最小生成树prim算法
    最小生成树kruskal算法
    React-redux原理探索
    Redux原理探索
    头条前端面试题汇总,会持续更新
    阿里前面面试题(最全),持续更新中
    ASP.Net MVC3/4中Model验证错误信息的本地化
  • 原文地址:https://www.cnblogs.com/loaderman/p/10881736.html
Copyright © 2011-2022 走看看