What Is Bootstrapping in Angular 4 and 5? - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
What Is Bootstrapping in Angular 4 and 5?

What Is Bootstrapping in Angular 4 and 5?

An NgModule describes how the application parts fit together. Every application has at least one Angular module, the root module that you bootstrap to launch the application. By convention, it is usually called AppModule.
If you use the Angular CLI to generate an app, the default AppModule is as follows:
  1. /* JavaScript imports */
  2. import { BrowserModule } from '@angular/platform-browser';
  3. import { NgModule } from '@angular/core';
  4. import { FormsModule } from '@angular/forms';
  5. import { HttpClientModule } from '@angular/common/http';
  6.  
  7. import { AppComponent } from './app.component';
  8.  
  9. /* the AppModule class with the @NgModule decorator */
  10. @NgModule({
  11. declarations: [
  12. AppComponent
  13. ],
  14. imports: [
  15. BrowserModule,
  16. FormsModule,
  17. HttpClientModule
  18. ],
  19. providers: [],
  20. bootstrap: [AppComponent]
  21. })
  22. export class AppModule { }

After the import statements is a class with the @NgModule decorator.
The @NgModule decorator identifies AppModule as an NgModule class. @NgModule takes a metadata object that tells Angular how to compile and launch the application.
  • declarations—this application's lone component.
  • imports—import BrowserModule to have browser specific services such as DOM rendering, sanitization, and location.
  • providers—the service providers.
  • bootstrap—the root component that Angular creates and inserts into the host index.html web page.
The default application created by the Angular CLI only has one component, AppComponent, so it is in both the declarations and the bootstrap arrays.

About Mariano

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.