Skip to content

No value accessor for from control #1018

@cschroeter

Description

@cschroeter

Bug, feature request, or proposal:

Bug

What is the expected behavior?

There should be an value accessor.

What is the current behavior?

main.987e5bf….bundle.js:17 EXCEPTION: No value accessor for form control with name: 'username'

What are the steps to reproduce?

This bug occurs only if you run ng build --prod.

Use angular-cli@webpack to create a new project.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';
import { MdCardModule } from '@angular2-material/card/card';
import { MdInputModule } from '@angular2-material/input/input';
import { MdButtonModule } from '@angular2-material/button/button';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    CommonModule,
    ReactiveFormsModule,
    MdCardModule,
    MdInputModule,
    MdButtonModule,
  ],
  providers: [],
  entryComponents: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {

}
<form [formGroup]="form">
  <md-card>
    <md-card-title>{{title}}</md-card-title>
    <md-card-content>
      <md-input placeholder="Username" formControlName="username"></md-input>
      <md-input placeholder="Password" formControlName="password"></md-input>
    </md-card-content>
    <md-card-actions align="end">
      <button md-button color="primary" type="submit">LOGIN</button>
    </md-card-actions>
  </md-card>
</form>

What is the use-case or motivation for changing an existing behavior?

Build an Angular2 app with prod flag.

Which versions of Angular, Material, OS, browsers are affected?

Angular@RC.5, Angular-CLI@webpack.2, Material@alpha.7-2, OSX 10.11.5

Is there anything else we should know?

As mentioned above, this only happens with the prod flag

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