i have FormsModule present in SharedModule..
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
@NgModule({
declarations: [],
imports: [
CommonModule
],
exports : [
CommonModule,
FormsModule,
BrowserModule
]
})
export class SharedModuleModule { }
and this sharedModule is imported in every module.
But Forms module doesnt work.
it gives error -
No directive found with exportAs 'ngForm'.
But when i import this module(where sharedModule is imported) in my app.module.ts, FormsModule start working.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { LoginModule } from './login/login.module'
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…