I am using AngularJS to generate form elements dynamically based on an array containing form details such as input type and value.
For example, here is the code snippet I have for creating a text input field:
<div ng-repeat="input in input_array">
<div ng-switch on="input.input_type">
<div ng-switch-when="text">
<label class="item item-input">
<input type="text" placeholder="Hello World">
</label>
</div>
</div>
</div>
Each form element is repeated within the top-level div
. The issue arises when the input.input_type
is set to "text", as it does not display the input unless the label
tags are removed. Even trying label
tags without attributes or content (<label>...</label>
) does not resolve the problem.
This behavior seems unusual. Can someone provide insights into why this might be happening? Thank you!
EDIT: Upon further investigation, I found that removing the input
tag and replacing it with text (
<label>Hello!</label>
) makes the input visible. So, could it be that inputs wrapped in a label
element are causing this issue?