Skip to main content

Posts

Showing posts with the label NgModules vs JavaScript Modules

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 differences in NgModules and JavaScript Modules?

What are the differences in NgModules and JavaScript Modules? NgModules vs. JavaScript Modules  - The NgModule is a TypeScript class decorated with @NgModule Decorator - is a fundamental feature of Angular. JavaScript also has its own module system for managing collections of JavaScript objects. It is completely different from the NgModule system. In JavaScript, each file is a module and all objects defined in the file belong to that module. The module declares some objects to be public by marking them with the export keyword. Other JavaScript modules use import statements to access public objects from other modules. The following is an example of specifying an export and import statements - export   class   AppComponent  {     //... } After export your class, you can import that file code in another file. import  {  AppComponent  }  from   './app.component' ; Both the JavaScript and An...