Skip to main content

Posts

Showing posts with the label NgModule.bootstrap

What classes should you not add to module declarations?

NgModule Declarations Array List   - We do not declare - Modules, Services, objects, and non-angular helper classes in the module's declarations .  Stayed Informed   -  What Is Modules? Syntax for NgModule declaration Array -   declarations: [     AppComponent ,     LoginComponent ,     MyPipe ,     MyDirective   ] The non-Angular classes and objects as following as - 1.       Strings 2.       Numbers 3.       Functions 4.       Entity Models 5.       Configurations 6.       and other helper classes Note - You can use directives, components, and pipes classes in a module  declaration . The example of what goes into declarations array list – //JavaScript imports directives, components, and pipes clas...

What Are the Purpose of @NgModule?

What Are the Purpose of @NgModule? The NgModule is used to simplify the ways you define and manage the dependencies in your applications and also you can consolidate different components and services into cohesive blocks of functionality. The @NgModule metadata divided into three categories as follows. 1.            Static 2.            Runtime 3.            Composability/Grouping Static  – It is compiler configuration and configured via the declarations array. Runtime  - It is injector configuration and configured via the provider’s array. Composability/Grouping  – Introducing NgModules  together and configured via the imports and exports arrays. The following is an example of specifying a NgModule metadata - @ NgModule ({    // Static, This is the compiler configuration ...

What’s the difference between a bootstrap component and an entry component?

A bootstrapped component is an entry component that Angular loads into DOM at the application launch and the other root components loaded dynamically into entry components. The following is an example of specifying a bootstrapped component - @ NgModule ({   declarations: [     AppComponent ,     LoginComponent   ],   imports: [     BrowserModule ,     FormsModule ,     HttpModule ,     AppRoutingModule   ],   providers: [],   bootstrap: [ AppComponent ]   // bootstrapped entry component }) export class AppModule { } The entry component is used to define components and created dynamically using the ComponentFactoryResolver. The @ NgModule.bootstrap property report the compiler that this is an entry component and it should generate code to bootstrap the application with this component. For more information, se...