Eladerezador
Eladerezador

Reputation: 1311

Modules versus standalone components

I have understood that in Angular 17 there is a tendency not to use modules even if they still exist and to make applications exclusively with standalone components, so it is more similar to Vuejs or React where there is no module in the concept. Additionally, a component standalone in the compilation, it seems that the loading is more gradual and improves the performance of the Angular application, is this true?

My question is the following, is there a limit of standalone components to use in a component?

For example in my component "app.component.ts" I have the following:

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [RouterOutlet, NavbarComponent, ButtonsBarComponent, FooterComponent],
  templateUrl: './app.component.html',
  styleUrl: './app.component.scss'
})
export class AppComponent {
  title = 'front-end';

  constructor() {

  }
}

In the array of the "imports" property, can I continue importing Standalone components or do Angular's good practices impose any limits?

NOTE: If I do not create modules manually because I exclusively use standalone components, it would be feasible to use library modules such as Angular Material to use its UI components.

Upvotes: 1

Views: 1300

Answers (1)

gru
gru

Reputation: 41

No, there is no limit to importing standalone components.

The only "limit" imposed by importing components is the bundle size that would be created. Thus making the app slower to load.

Upvotes: 1

Related Questions