Angularjs: change input type Dynamically

Viewed 18307

I have a list which sometimes has true or false value. When I'm using ng-repeat to show the list with the value inside an <input type="text"> , I'd like to have <input type="checkbox"> if the value matches a boolean.

<table class="table table-hover table-striped table-bordered">
    <tbody>
        <tr ng-repeat="parameter in parameter_list">
            <th class="text-left">
                {{parameter.title | uppercase}}
            </th>
            <td class="text-left">
              <div class="form-group">
                <input type="text" ng-model="parameter_list[$index].value" class="form-control">
              </div>
            </td>
        </tr>
    </tbody>
</table>

Any ideas, how can I achieve this ?

Fiddle

Edit : It's not a duplicate since I don't have the input type in a $scope variable.

5 Answers
Related