Akhilendra yadav Akhilendra yadav - 2 months ago 7
AngularJS Question

How to generate dynamically input field on multiple checkbox checked [AngularJS]

I want to generate text field on every checked boxes.My checkbox field is also dynamic.
my Sample code is here.

<div>
<labes> Products </label>
<li ng-repeat="item in INDproducttypes">
<input type="checkbox" ng-model="indProducts['item.value']"/>
</li>
</div>


<div>
<div ng-show="indProducts==true">
<input type="text" name="name">
</div>
</div>


Thanks in adavance.

Answer

Here is a sample codepen for this problem What is understood is when we check check box input field is shown otherwise hidden

<div ng-app="DataEntryApp" ng-controller="DataEntryController">

<div>
<labes> Products </label>
<li ng-repeat="item in INDproducttypes">
<input type="checkbox" ng-model ="item.value"  />
</li>
</div>

<div ng-repeat="item in INDproducttypes">
<div ng-show = "item.value">
<input type="text" name="name">
</div>
</div>

</div>

Here is working code pen http://codepen.io/vkvicky-vasudev/pen/BLLNwZ

If any doubt or change please communicate to me

Comments