我一直在看视频和阅读文章,但这篇文章让我很困惑,在文章的开头它说
The applications in Angular follow modular structure. The Angular apps will contain many modules, each dedicated to the single purpose. Typically module is a cohesive group of code which is integrated with the other modules to run your Angular apps.
A module exports some classes, function and values from its code. The Component is a fundamental block of Angular and multiple components will make up your application.
A module can be a library for another module. For instance, the angular2/core library which is a primary Angular library module will be imported by another component.
它们是可交换的条件吗?组件是模块吗?但反过来不是吗?
角组件
组件是Angular应用的基本构建块之一。一个应用可以有多个组件。在一个正常的应用程序中,一个组件包含一个HTML视图页面类文件,一个类文件控制HTML页面的行为和CSS/scss文件样式你的HTML视图。组件可以使用@Component装饰器创建,它是@angular/core模块的一部分。
import { Component } from '@angular/core';
并创建一个组件
@Component({selector: 'greet', template: 'Hello {{name}}!'})
class Greet {
name: string = 'World';
}
下面是创建组件或angular应用的教程
角模块
angular模块是一组angular的基本构建模块,比如组件、指令、服务等。一个应用程序可以有多个模块。
可以使用@NgModule装饰器创建模块。
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
角组件
组件是Angular应用的基本构建块之一。一个应用可以有多个组件。在一个正常的应用程序中,一个组件包含一个HTML视图页面类文件,一个类文件控制HTML页面的行为和CSS/scss文件样式你的HTML视图。组件可以使用@Component装饰器创建,它是@angular/core模块的一部分。
import { Component } from '@angular/core';
并创建一个组件
@Component({selector: 'greet', template: 'Hello {{name}}!'})
class Greet {
name: string = 'World';
}
下面是创建组件或angular应用的教程
角模块
angular模块是一组angular的基本构建模块,比如组件、指令、服务等。一个应用程序可以有多个模块。
可以使用@NgModule装饰器创建模块。
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }