Tin't hindrance to 'ngModel' since it isn't a recognized place of 'enter'

Tin't hindrance to 'ngModel' since it isn't a recognized place of 'enter'

I person this elemental enter successful my constituent which makes use of [(ngModel)] :

<input type="text" [(ngModel)]="test" placeholder="foo" />

And I acquire the pursuing mistake once I motorboat my app, equal if the constituent is not displayed.

region.js:461 Unhandled Commitment rejection: Template parse errors:Tin't hindrance to 'ngModel' since it isn't a recognized place of 'enter'.

Present is the constituent.ts:

import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';import { Intervention } from '../../model/intervention';@Component({ selector: 'intervention-details', templateUrl: 'app/intervention/details/intervention.details.html', styleUrls: ['app/intervention/details/intervention.details.css']}) export class InterventionDetails{ @Input() intervention: Intervention; public test : string = "toto";}

Sure, that's it. Successful the app.module.ts record, I conscionable added:

import { FormsModule } from '@angular/forms';[...]@NgModule({ imports: [ [...] FormsModule ], [...]})

Successful command to beryllium capable to usage 2-manner information binding for signifier inputs you demand to import the FormsModule bundle successful your Angular module.

For much accusation, seat the Angular 2 authoritative tutorial present and the authoritative documentation for types.


Angular template-pushed varieties supply a easy manner to negociate person enter and information validation inside your functions. Nevertheless, builders typically brush surprising behaviour once trying to hindrance signifier components utilizing ngModel. A communal content arises once ngModel appears unresponsive oregon fails to replace the underlying information exemplary. This frequently happens once the component sure to ngModel isn't a acknowledged enter power, starring to disorder and vexation. This article volition make clear wherefore this occurs and supply options to guarantee your template-pushed varieties relation accurately. We'll research the causes down this behaviour and message applicable methods to resoluteness these binding points effectively.

Knowing Wherefore ngModel Mightiness Not Activity Arsenic Anticipated

The ngModel directive successful Angular is designed to activity seamlessly with modular HTML enter components similar ,