Repository navigation
Closed
Closed
Copy link
Labels
area: formshotlist: components teamRelated to Angular CDK or Angular MaterialRelated to Angular CDK or Angular MaterialregressionIndicates than the issue relates to something that worked in a previous versionIndicates than the issue relates to something that worked in a previous versiontype: bug/fix
Description
I'm submitting a...
[x] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
When compiling an App with Reactive Forms using AOT in 5.0.0-beta.7 i'm getting the following Error when navigating to the Form:
Expected behavior
Reactive Forms should work like in beta.6
Minimal reproduction of the problem with instructions
test.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TestComponent } from './test.component';
@NgModule({
declarations: [ TestComponent ],
imports: [ CommonModule, ReactiveFormsModule ],
exports: [ TestComponent ],
providers: [],
})
export class TestModule {}
test.component.ts
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
@Component({
selector: 'app-form',
templateUrl: './test.component.html',
styleUrls: ['./test.component.css']
})
export class TestComponent implements OnInit {
form: FormGroup;
constructor() { }
ngOnInit() {
this.form = new FormGroup({
name: new FormControl('test')
});
}
}
test.component.html
<form [formGroup]="form">
<input type="text" formControlName="name">
</form>
What is the motivation / use case for changing the behavior?
Environment
Angular version: 5.0.0-beta.7
Browser:
- [x] Chrome (desktop) version 63
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [x] Safari (desktop) version 10.1.2
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
Others:
@angular/cli: 1.5.0-beta.0
node: 7.5.0
os: darwin x64
@angular/animations: 5.0.0-beta.7
@angular/common: 5.0.0-beta.7
@angular/compiler: 5.0.0-beta.7
@angular/core: 5.0.0-beta.7
@angular/forms: 5.0.0-beta.7
@angular/http: 5.0.0-beta.7
@angular/platform-browser: 5.0.0-beta.7
@angular/platform-browser-dynamic: 5.0.0-beta.7
@angular/router: 5.0.0-beta.7
@angular/cli: 1.5.0-beta.0
@angular/compiler-cli: 5.0.0-beta.7
@angular/language-service: 5.0.0-beta.7
typescript: 2.4.2
Reacted by Brian Walker, EreckGordon, softsimon, Lazar Ljubenović, Pierre Rochard, bmayen, Anton Li, AleksanderSzyszka, Kasidit Iamthong, Dessalines and 23 more
Reacted by Deryk w. King
Metadata
Metadata
Assignees
Labels
area: formshotlist: components teamRelated to Angular CDK or Angular MaterialRelated to Angular CDK or Angular MaterialregressionIndicates than the issue relates to something that worked in a previous versionIndicates than the issue relates to something that worked in a previous versiontype: bug/fix
Activity
AustinMatherne commentedon Sep 16, 2017
Not sure if it's the same bug, but I'm seeing the same error after upgrading from 4.3.6 to 4.4.1.
Toxicable commentedon Sep 16, 2017
Can confirm this for v4.4.1 only when running in AOT
To Reproduce
ng new noformproviderReplce app.component.ts with
ng serve --aotopen up browser and inspect console for error:
alexzuza commentedon Sep 16, 2017
I think the problem here is
forms.metadata.jsonthat angular published on npmLet's see why..
I compared jit and aot code generated by angular 5.0.0-beta.7.
Angular generates wrong reference to ControlContainer provider(
useExisting) forFormGroupDirectivejit
aot
Then i investigated how angular gets reference and found out the following
forms.metadata.json angular 4.3.6
forms.metadata.json angular since 4.4.x
where
ɵeform.d.ts
I think it can be related with the fact that
NgFormdirective declares provider with the same name asFormGroupDirectivehttps://github.com/angular/angular/blob/5.0.0-beta.7/packages/forms/src/directives/ng_form.ts#L21-L25bjornharvold commentedon Sep 16, 2017
Same here in 4.4.1
PierreRochard commentedon Sep 16, 2017
👍 same here, just updated to 4.4.1
fpmk commentedon Sep 17, 2017
Updated to 4.4.1 and get same error, but reverting to 4.3.6 not helped, removed all cache, node_modules and installed fresh version.
alexzuza commentedon Sep 17, 2017
@fpmk Can you share small repo to reproduce it on 4.3.6?
fpmk commentedon Sep 17, 2017
@alexzuza sorry it was my fault, I have ^4.3.6 and when I start npm install it installs me 4.4.1. 4.3.6 seems fine.
dessalines commentedon Sep 17, 2017
Verified that this works fine in
4.3.6, but is broken in4.4.1. I feel like a unit test should've caught this before a release.dottodot commentedon Sep 17, 2017
Yeah same here in 4.4.1. I've reverted to 4.3.6 and that's ok.
smoke commentedon Sep 18, 2017
Same here with 4.4.1 and AOT using
[formControl]="myFormControl"throwsNo provider for NgModel!and[formGroup]="myForm"throwsNo provider for NgForm!With 4.3.6 all is working.
30 remaining items
dinerotah commentedon Sep 20, 2017
I confirm problem resolved.
Thanks for all.
alexanderknapstein commentedon Sep 20, 2017
Thanks to all. The update fixes the problem!
jponeill commentedon Sep 23, 2017
This still doesn't appear to be fixed in the 5.x branch. Coming soon?
intellix commentedon Sep 23, 2017
Temporary workaround for beta:
npm i @angular/[email protected]andreypelykh commentedon Sep 25, 2017
I had the same issue with 4.2.4 version. I've just made next steps:
npm ioryarn;and it works now. Thanks for everyone!
Updated Angular to fix Forms issue in prod mode. See angular/angular#…
filipesilva commentedon Jan 31, 2018
There has been a report in Angular CLI of another library that suffered from this problem with Angular v5 (angular/angular-cli#9383, more info in psykolm22/angular-google-place#29 (comment)). Maybe this is still a problem.
jdhines commentedon Mar 23, 2018
Thanks for this. I was on 4.4.1, and the error I got didn't even point to ng-forms. It just said
No provider for e!.SalilGokhale commentedon Jun 12, 2018
I am experiencing this same 'No provider for e!' error on v5.2.7. Any ideas?
fontenele commentedon Aug 12, 2018
The same on 5.2.9
salcott commentedon Feb 23, 2019
--prod flag,
No provider for e!, 4.4.2, every view which contains a form...cpower1994 commentedon Mar 11, 2019
--prod flag on 5.2.0 giving me the same issue
angular-automatic-lock-bot commentedon Sep 14, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.