Is it possible to use paper-radio buttons inside a template?

I am creating a project with Polymer and have the following code:

<paper-radio-group> <template repeat="{{answer in answers}}"> <p> <paper-radio-button name="{{answer.choice}}" label="{{answer.choice}}"></paper-radio-button> </p> </template> </paper-radio-group> 

I have a list of answers that I want to use in a paper radio group. It works well. Each item in the answer array is displayed as a paper button.

The problem is that they are not related to each other. Thus, when you select one button to feed paper, the other does not cancel. This is probably due to the fact that the paper-radio group tag is outside the template tag. But putting it inside, it will repeat like a button with a radio, and that won't work either.

Is there any way to make this work? Or is it impossible?

+5
source share
1 answer

<paper-radio-group> expects <paper-radio-button> as children. When you transfer them to other elements, such as <p> , <paper-radio-group> cannot control the state.
The <template> element is not actually included in the DOM and does not interfere with the rendering of elements.

+6
source

Source: https://habr.com/ru/post/1208483/


All Articles