1

I'm trying to make an angular-repeat inside another angular repeat. If I write:

{{field.labels}} It outputs an array like this:

[{"name":"media","label":"Media"},{"name":"frilans","label":"Frilans"}]

If I try something really simple, like

<fieldset
    class="options"
    ng-repeat="mylabel in field.labels"
>


    <input type="radio" >{{mylabel}}
</fieldset> 

It seems to be working, because the number of input-tags correspond to the number of items in the array, but It won't output {{mylabel}}. Why?

Here is a complete sample of the code: http://codepen.io/anon/pen/FEyir

Here is the complete field-variable, .options is only used when type=radio: ng-switch-when="radio"

    fields:
        [
            {
                label: 'First Name',
                name: 'firstname',
                key: '',
                type: 'text',
                //fixa requierd i templatesen
                required: true
            },
            {
                label: 'Last Name',
                name: 'lastname',
                key: '',
                required: true,
            },
            {
                label: 'Email',
                name: 'email',
                key: '',
                required: true,
                type: 'email',
            },
            {
                key: '',
                type: 'radio',
                labels:
                [
                    {
                        name: 'media',
                        label: 'Media'
                    },
                    {
                        name: 'frilans',
                        label: 'Frilans'

                    }

                ],
            }
        ],

    },
2
  • 1
    Should't this be <input type="radio" >{{mylabel.label}}? Commented Sep 16, 2013 at 9:40
  • that doesn't work either. Commented Sep 16, 2013 at 10:24

1 Answer 1

1
<fieldset
class="options"
ng-repeat="mylabel in field.labels">


<input type="radio" >{{mylabel}}
</fieldset> 

Replcae To:

<!--radiobuttons-->
<fieldset ng-switch-when="radio" class="options">

       <span ng-repeat="mylabel in field.labels">
          <input type="radio" > {{mylabel.label}}
        </span>
  </fieldset>

codepen code

Sign up to request clarification or add additional context in comments.

2 Comments

Nope, that doesn't output anything either. That isn't to weird, as {{mylabel}} seems to be empty, it ougth to output an object,
i need data of field variable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.