Skip to content Skip to sidebar Skip to footer

Angular 2.0, Typescript And 'form_directives' Module

I am using Angular 2.0 Alfa 35. When I am importing FORM_DIRECTIVES (which is a new name for formDirectives on Alfa 35) I am getting a Typescript error: error TS2305: Module ''angu

Solution 1:

As of today for Angular 2 Beta it should be:

import {FORM_DIRECTIVES} from'angular2/common'

Solution 2:

Angular >= RC.5

import { FormsModule, ReactiveFormsModule } from'@angular/forms';

@NgModule({
  imports: [BrowserModule, FormsModule, ReactiveFormsModule],
  ...
})

Solution 3:

Yup as we all know angular2 is in beta now so almost there is negligible chance of Breaking changes either it is the case of List of imports or any syntax, btw you can import necessary form imports from here...

import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgIfNgForm, Control, ControlGroup, FormBuilder, Validators} from'angular2/common';

for More list of all imports for angular2 beta you can refer here

update

as of updated angular2 RC there is change

import { FORM_DIRECTIVES } from'@angular/common';

Solution 4:

All of the previous answers given are no longer workable. Angular2 now has an entirely different structure and package name in NPM.

For anything since Angular 2.0.0-rc.0 (from May 2, 2016), you have to use this for the old forms system:

import { FORM_DIRECTIVES } from'@angular/common';

Update: Or you can load it from here, if you are using the new Angular 2 forms system:

import { FORM_DIRECTIVES } from'@angular/forms';

You can read about it in the Angular 2 ChangeLog.

Solution 5:

import {FORM_DIRECTIVES} from 'angular2/angular2';

worked for me with angular2@2.0.0-alpha.35

Post a Comment for "Angular 2.0, Typescript And 'form_directives' Module"