python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
@NgModule decorator

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
  declarations: [], //declarations is used for configure the selectors.
  entryComponents: [], //entryComponents is used to generate the host factory.

  //Runtime or injector configuration
  providers: [], // providers is used for runtime injector configuration.

  //Composability and Grouping
  imports: [], // imports used for composing NgModules together.
  exports: [] //A list of declarations components, directives, and pipes classes that an importing module can use.
})

ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions