0

for using ngModel directive, I included

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

as mentioned here. But now I'm getting xhr error for loading @angular/forms from npmcdn (guess it won't be there) while using plunker. any idea on what to include in plunker ?

candidJ
  • 4,289
  • 1
  • 22
  • 32
  • update working plunk in the question. related to http://stackoverflow.com/questions/38887044/angular-2-rc-5-plunker-error-typeerror-core-1-ngmodule-is-not-a-function . – candidJ Aug 25 '16 at 05:54

2 Answers2

0

Add to app.component.ts:

import { NgModel } from '@angular/forms'

and

providers: [NgModel],

to the @Component({...})

Andrei Zhytkevich
  • 8,039
  • 2
  • 31
  • 45
  • we need not import `NgModel` as we are importing `FormsModule` in root component. same goes for `providers` – candidJ Aug 25 '16 at 05:34
0

Make sure to have 'forms' specified in ngPackageNames in config file

    var ngPackageNames = [
  'common',
  'compiler',
  'core',
  'forms',
  'http',
  'platform-browser',
  'platform-browser-dynamic',
  'router',
  'router-deprecated',
  'upgrade',
];