mardi 3 octobre 2017

How to check multiple users then return all checked user using angular 4 and typescript?

i want to display all employees then check the absents then return who are absents

This is my form :

<form [formGroup]="createSessionForm" (ngSubmit)="onSubmit(createSessionForm.value)" #f="ngForm">
   <div class="row">
    <div class="form-group" class="col-lg-5">
      <ul class="flex-outer">
        <li>
          <label for="first-name"> Attendance </label>
          <a role="botton">
           <span (click)="open(content)"> Display </span>
           <ng-template #content let-c="close" let-d="dismiss">
            <!-- Modal -->
           <div class="modal-dialog modal-lg" >
            <div class="modal-header ">
              <h4 class="modal-title">  Attendance Form </h4>
              <button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <!-- Modal body -->
            <div class="modal-body" >
             <form [formGroup]="attendanceForm (ngSubmit)="onSubmit(t)" #t="ngForm">
              <div class="row">
                <table class="table table-hover table-condensed text-center table-bordered">
                  <thead>
                    <tr>
                        <th> Names </th>
                        <th>  Attendance </th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr *ngFor="let attendance of attendances">
                       <td >  </td>
                       <td> 
                          <div class="form-check">
                             <label class="form-check-label">
                               <input  multiple type="checkbox" class="form-check-input" formControlName="isAttend">
                             </label>
                          </div>
                       </td>
                    </tr>
                  </tbody>
                </table>
           </div>

I displayed all employees ({attendance.Emp_Name) and behind each employee his checbox , if he is absent then i'll check it .. How can i return only checked employees using Angular 4 ?




Aucun commentaire:

Enregistrer un commentaire