0Pricing
Angular Academy · Lesson

Importing Dependencies Directly

Add imports to a component instead of a module.

Importing Dependencies Directly

A standalone component declares what it uses in its own imports array. This replaces the NgModule declarations/imports split.

The imports Array

Add other standalone components, directives, and pipes to the imports array of the @Component decorator.

import { Component } from '@angular/core';
import { ChildComponent } from './child.component';

@Component({
  selector: 'app-parent',
  imports: [ChildComponent],
  template: '<app-child></app-child>'
})
export class ParentComponent {}

All lessons in this course

  1. Why Standalone Components
  2. Creating Standalone Components
  3. Importing Dependencies Directly
  4. Bootstrapping a Standalone App
← Back to Angular Academy