Skip to main content

Posts

Showing posts with the label What are the @NgModule Metadata Properties?

What Types of @NgModules?

What Types of NgModules? There are four types of NgModules – 1.            Features Module 2.            Routing Module 3.            Service Module 4.            Widget Module 5.            Shared Module Features Module  – The feature modules are NgModules  for the purpose of organizing an application code. Routing Module  – The Routing is used to manage routes and also enables navigation from one view to another view as users perform application tasks. Service Module  – The modules that only contain services and providers. It provides utility services such as data access and messaging. The root AppModule is the only module that should import service modules. The HttpClientModule  is a good ...

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 are the @NgModule Metadata Properties?

The @NgModule decorator identifies AppModule as a NgModule class. The @NgModule takes a metadata object that tells Angular how to compile and launch the application. The NgModule’s important metadata properties are as follows – 1.            providers 2.            declarations 3.            imports 4.            exports 5.            entryComponents 6.            bootstrap 7.            schemas 8.            id The @NgModule class with the decorator and metadata properties - @ NgModule ({    providers? :   Provider []    declaration...