Using Other Components
Components depend on other components, directives and pipes. For example, TodoListComponent relies on TodoItemComponent. To let a component know about these dependencies we group them into a module.
1
import {NgModule} from '@angular/core';
2
3
import {TodoListComponent} from './components/todo-list.component';
4
import {TodoItemComponent} from './components/todo-item.component';
5
import {TodoInputComponent} from './components/todo-input.component';
6
7
@NgModule({
8
imports: [ ... ],
9
declarations: [
10
TodoListComponent,
11
TodoItemComponent,
12
TodoInputComponent
13
],
14
bootstrap: [ ... ]
15
})
16
export class ToDoAppModule {
17
}
Copied!
The property declarations expects an array of components, directives and pipes that are part of the module.
Please see the Modules section for more info about NgModule.
Copy link