samedi 21 mai 2016

Clean form in div after unchecking in checkbox in angular

What im trying to obtain is each time Im checking a checkbox a div should show cleared.

For example: If I check the checkbox and I fill those forms then I unchecked it and then again I check it I want it to be cleared. Im not using the form tag because these is just a small part of a bigger form and I just whant to take effect on those forms.

What ive done is just using the model directive to each time I check the div with the form should show but I dont have clue how can I clear it each time it shows.

<div class="form-group">
    <label>Ocupa factura?</label>
    <input type="checkbox" name="factura" class="form-control" ng-model="factura">
</div>
<div style="background-color:lightgrey;border-style:solid;border-width:1px" ng-show="factura">
    <div class="form-group">
        <label style="display:block;">Datos de facturacion</label>
        <textarea style="display:block;" name="datosdefacturacion" rows="5" cols="70"></textarea>
    </div>
    <div class="form-group">
        <label style="display:block;">Días de facturacion</label>
        <label class="checkbox-inline">
        <input type="checkbox" name="lunesfactura"  value="lunesfactura"> L
        </label>
        <label class="checkbox-inline">
        <input type="checkbox" name="martesfactura" value="martesfactura"> M
        </label>
        <label class="checkbox-inline">
        <input type="checkbox" name="miercolesfactura"  value="miercolesfactura"> M
        </label>
        <label class="checkbox-inline">
        <input type="checkbox" name="juevesfactura" value="juevesfactura"> J
        </label>
        <label class="checkbox-inline">
        <input type="checkbox" name="viernesfactura"  value="viernesfactura"> V
        </label>
        <label class="checkbox-inline">
        <input type="checkbox" name="sabadofactura" value="sabadofactura"> S
        </label> 
        <label class="checkbox-inline">
        <input type="checkbox"  name="domingofactura" value="domingofactura"> D
        </label>     
    </div>
</div>

Sorry, english is not my first langague. Thanks btw.




Aucun commentaire:

Enregistrer un commentaire