...

/

Categories of Metadata Used by @NgModule Decorator

Categories of Metadata Used by @NgModule Decorator

Let's get into the details of categories of metadata that the '@NgModule' decorator uses.

Categories of metadata

When the Angular CLI creates a new application, it generates a single NgModule file for us. This file is always called app.module.ts and looks like this:

import { AppPage } from './app.po';
import { browser, logging } from 'protractor';

describe('workspace-project App', () => {
  let page: AppPage;

  beforeEach(() => {
    page = new AppPage();
  });

  it('should display welcome message', () => {
    page.navigateTo();
    expect(page.getTitleText()).toEqual('Client-Contacts-Manager-Angular app is running!');
  });

  afterEach(async () => {
    // Assert that there are no errors emitted from the browser
    const logs = await browser.manage().logs().get(logging.Type.BROWSER);
    expect(logs).not.toContain(jasmine.objectContaining({
      level: logging.Level.SEVERE,
    } as logging.Entry));
  });
});
app.module.ts file in Angular

There isn’t a lot going on here. There aren’t any functions, events, or loops in the main AppModule class. Everything is within the @NgModule decorator. ...