Angular Entry Components

Angular Entry Components

An entry component is any component that Angular loads imperatively, (which means you’re not referencing it in the template), by type. You specify an entry component by bootstrapping it in an NgModule, or including it in a routing definition.

 

To contrast the two types of components, there are components which are included in the template, which are declarative. Additionally, there are components which you load imperatively; that is, entry components.

 

There are two main kinds of entry components:

 

  • The bootstrapped root component.
  • A component you specify in a route definition.

A bootstrapped entry component

The following is an example of specifying a bootstrapped component, AppComponent, in a basic

 

app.module.ts:

@NgModule({

declarations: [

AppComponent

],

imports: [

BrowserModule,

FormsModule,

HttpModule,

AppRoutingModule

],

providers: [],

bootstrap: [AppComponent] // bootstrapped entry component

})

 

A bootstrapped component is an entry component that Angular loads into the DOM during the bootstrap process (application launch). Other entry components are loaded dynamically by other means, such as with the router.

IT Professionals, Web Developers, Web Programmers, IT students can Apply for the certification course to move ahead in their careers.

Angular 4 Tutorial IndexBack to Angular 4 Tutorial Main Page

Share this post
[social_warfare]
Angular NgModules and JavaScript Modules
Providers in Angular

Get industry recognized certification – Contact us

keyboard_arrow_up