Skip to content

@angular/forms 404 (Not Found) #1199

@maliq

Description

@maliq

SO.
Mac OSX (El Capitan)
Versions.
angular-cli: 1.0.0-beta.8
node: 5.9.1
os: darwin x64

Repro steps. Was this an app that wasn't created using the CLI? What change did you
do on your code? etc.

Update to angular cli 1.0.0-beta.8 and follow the upgrade sequence (https://github.com/angular/angular-cli#updating-angular-cli)

Based in guide https://angular.io/docs/ts/latest/cookbook/dynamic-form.html disable old form and enable new one. In main.ts add import and load forms like show below:

import { disableDeprecatedForms, provideForms } from '@angular/forms';

if (environment.production) {
  enableProdMode();
}

bootstrap(AppComponent, [.., disableDeprecatedForms(), provideForms()]);

The log given by the failure. Normally this include a stack trace and some
more information.

error output:

GET http://localhost:4200/vendor/@angular/forms 404 (Not Found)
Unhandled Promise rejection: Error: XHR error (404 Not Found) loading http://localhost:4200/vendor/@angular/forms
at XMLHttpRequest.wrapFn as _onreadystatechange
at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:356:38)
at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:256:48)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:423:34)
Error loading http://localhost:4200/vendor/@angular/forms as "@angular/forms" from http://localhost:4200/main.js ; Zone: ; Task: Promise.then ; Value: Error: Error: XHR error (404 Not Found) loading http://localhost:4200/vendor/@angular/forms(…)
Error: Uncaught (in promise): Error: Error: XHR error (404 Not Found) loading http://localhost:4200/vendor/@angular/forms(…)

Mention any other details that might be useful.

Solution: add '@angular/forms' to "Angular specific barrels." in system-config.ts and fixed.

..
const barrels: string[] = [
  // Angular specific barrels.
  '@angular/core',
  '@angular/common',
  '@angular/compiler',
  '@angular/forms', // added
  '@angular/http',
  '@angular/router',
  '@angular/platform-browser',
  '@angular/platform-browser-dynamic',
..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions