Check the input and then click the button

Asked

Viewed 40 times

0

As I do only if the input is marked is that one can click on "ok,".

<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>

1 answer

0


Use the events and attributes.

in his input you do so:

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

in his componente:

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

on your button:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.