0
votes

I am following an Angular Tutorial HERE.

On Imports, we bring in the following:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms'

In the @NgModule, we only import BrowserModule & FormsModule.

imports: [
    BrowserModule,
    FormsModule
],

Why dont we import in the NgModel? Is this becuase its a part of the Angular Core Library?

3

3 Answers

2
votes

NgModel directive is included in FormsModule.

https://angular.io/api/forms/NgModel

Your import of it in your app is enough for getting it available.

0
votes

From angular 4 docs :

You must import:

import { NgModel } from'@angular/forms';
0
votes

angular have is own module system. the part of angulat that handle it called "NgModule " you need to import it when you create a module. but you dont need to import it inside the module... you just use it to create the module . because that you don't see NgModule in the import or export section. read in the doc