1

I am currently using beta.17 within this web application i am building, as it had issues when trying to upgrade. But anyway thats not the issue.

I have a Model form, and I am trying to use Radio Buttons, and I know there was always issues with it until the fix on rc2.

But here is my section of the form using them:

<div *ngFor="let ctrl of markingForm.controls['design'].controls; let i = index;" [ngFormModel]="ctrl">
    <accordion-group [heading]="ctrl.value.name" >
        <div *ngFor="let design of studentAssign.assID[0].template[0].design; let j = index">
            <label class="form-check-inline" *ngFor="let comment of design.comments">
                <input name="input" class="form-check-input" type="radio" value="test" ngControl="comment">{{comment.short}}
            </label>
        </div>
    </accordion-group>
</div>

I am trying to bind the value to 'comment' within this part of the ControlArray:

"design": [
    {
      "name": "Rubric Section Name",
      "comment": null,
      "mark": null,
      "maxMark": 50
    },
    {
      "name": "ttt",
      "comment": null,
      "mark": null,
      "maxMark": 20
    }
  ]

(the 'design' part is populated before hand and could be X amount big).

So realistically it should work right?

But i get this error:
ORIGINAL EXCEPTION: TypeError: Cannot read property 'value' of null
ORIGINAL STACKTRACE:
TypeError: Cannot read property 'value' of null
    at RadioControlValueAccessor.onChange 

Is there any way around this? Or is there a fix or do I need to upgrade to rc2? Or can the radio buttons be easily replicated with checkboxes?

Jezyk Danzowki
  • 229
  • 1
  • 5
  • 15
  • Any reason you're not updating to a more recent version. beta.17 is stone age. – Günter Zöchbauer Sep 10 '16 at 18:20
  • @GünterZöchbauer when I started working on this project it was during beta.17, but when I transitioned over to RC the project it would not work, just no display no errors. It is a Uni Project that is almost over, so it is a bit late to upgrade now. I know I could create a scratch project and transition each module, service and component over but would consume too much time tbh... – Jezyk Danzowki Sep 10 '16 at 18:40
  • 1
    Radios didn't work well back then. Perhaps http://stackoverflow.com/questions/35653175/how-to-bind-to-radio-buttons-in-angular2-beta-6/35653911#35653911 provides something that might help you. – Günter Zöchbauer Sep 10 '16 at 18:42
  • 1
    @GünterZöchbauer ahh brilliant, thanks for replying though I really appreciate that. I have opted for checkboxes for now but I will take a look at that radio button binding you linked! – Jezyk Danzowki Sep 10 '16 at 18:44

0 Answers0