Check the input and then click the button

0

What I do for only if the input is checked is that the person can click the "ok, I got it".

<div class="container">

    <button type="button" class="btn btn-info" (click)="openModal(template)">Create template modal</button>

    <ng-template #template>
        <div class="modal-header">
            <h4 class="modal-title">Termo</h4>
            <button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()">
         <span aria-hidden="true">&times;</span>
       </button>
        </div>
        <div class="modal-body">
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
             Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
             when an unknown printer took a galley of type and scrambled it to make a type
           </p>

           <div class="box_termo">
            <input class="input_box" name="checkbox" type="checkbox" value="termo" />
            Li e aceito os termos e condições acima.
            <br><br>
            <button type="button" class="btn btn-warning btn-lg btn-block">ok,entendi</button>
          </div>
    </div>
    </ng-template>

</div>
    
asked by anonymous 10.03.2018 / 01:20

1 answer

0

Use events and attributes.

In your input you do so:

<input type="checkbox" [checked]="termo" (change)="termo= !termo">

on your componente :

// você cria a variável e atribui false
termo: boolean = false;

on your button:

<button type="submit" [disabled]="!termo">ok,entendi</button>
    
10.03.2018 / 01:36