NgModule 是一个用 @NgModule 装饰的类,它将相关的 components、directives、pipes 和 services 分组到一个内聚的块中,告诉 Angular 如何编译和联接它们。(注意:现代 Angular 越来越倾向于使用 standalone components 而不是 NgModules,但理解 NgModules 对于大多数现有代码库仍然至关重要。)
NgModule 的结构
ts
{ } ;
{ } ;
({
: [, ],
: [, ],
: [],
: [],
})
{}
