components icon indicating copy to clipboard operation
components copied to clipboard

md-radio-group "No value accessor for x"

Open fxck opened this issue 10 years ago • 5 comments

I'm trying to use md-radio-group, like this

<form [ngFormModel]="form">
  <md-radio-group
    [ngModel]="data.foo"
    ngControl="foo">
    <md-radio-button *ngFor="#option of radioButtonOptions" [value]="option.value">
      {{ option.label }}
    </md-radio-button>
  </md-radio-group>
</form>

along with

class WhateverCmp {
  public data = { foo: null };

  public radioButtonOptions = [
    {
      label: 'Bar',
      value: 'bar'
    },
    {
      label: 'Baz',
      value: 'baz'
    }
  ];

  constructor(private _fb: FormBuilder) {
    this.form = _fb.group({
      foo: [ '', Validators.required ]
    });
  }

}

and I'm getting ORIGINAL EXCEPTION: No value accessor for 'foo'

using alpha.3 and angular b.16

fxck avatar Apr 28 '16 11:04 fxck

@fxck this is working for me when tested against the latest code in master. Closing for now - please let me know if this is not resolved and I will reopen.

robertmesserle avatar May 18 '16 01:05 robertmesserle

I am experience this issue as well.

Using: @angular/core: "2.0.0-rc.1" @angular2-material/core: "^2.0.0-alpha.4" @angular2-material/radio: "^2.0.0-alpha.4"

http://plnkr.co/edit/sMHZESGaE4qjHCshmnzO?p=preview

mashhoodr avatar May 20 '16 09:05 mashhoodr

@robertmesserle well it's not working on whatever is released on npm, http://plnkr.co/edit/uM0WoalscT5Cx4XFev5V?p=preview

fxck avatar May 24 '16 11:05 fxck

You have to include MdRadioGroup in the directives

mmgyce avatar Jun 08 '16 17:06 mmgyce

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.