title: How to perform validation in radio button in angular 6?
body: <p>Actaully i have two types of input types: one is normal text and another is radio type.I want to valdiate both the fields before submit button is entered.</p>
  
  <p><a href="https://i.stack.imgur.com/5xfAB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5xfAB.png" alt="enter image description here"></a></p>
  
  <p>For this normal input field i made the validation but i have no idea how to do for the radio button.I want to validate if user doesnot select any radio button.</p>
  
  <pre><code>&lt;form  name="form" #f="ngForm" (ngSubmit)="f.form.valid &amp;&amp; onSubmit()" novalidate class="feedback-form"&gt;
           &lt;div class="col-md-12"&gt;
  
              &lt;div class="form-group col-md-4"&gt;
                 &lt;label for="selectionDate"&gt;Selection Date&lt;/label&gt;
                 &lt;input type="text" 
                 id="selectionDate"
                 class="form-control"
                  name="selectionDate"
                  placeholder="Please enter the date" 
                 [(ngModel)]="selection.selectionDate"
                  #selectionDate="ngModel"
                  [ngClass]="{ 'is-invalid': f.submitted &amp;&amp; selectionDate.invalid }"
                   required
                    /&gt;
  
               &lt;div *ngIf="f.submitted &amp;&amp; selectionDate.invalid" class="invalid-input"&gt;
              &lt;!-- individual validation errors --&gt;
              &lt;div *ngIf="selectionDate.errors?.required"&gt;DateField is required&lt;/div&gt;
            &lt;/div&gt;
  
              &lt;/div&gt;
              &lt;div class="form-group col-md-4"&gt;
                 &lt;label for="selectedBy"&gt;Selected By&lt;/label&gt;
                 &lt;br&gt;
                 &lt;label class="radio-inline"&gt;
                 &lt;input type="radio" name="selectedBy" 
                 [(ngModel)]="selection.selectedBy" value="Department"&gt;Department
                 &lt;/label&gt;
                 &lt;label class="radio-inline"&gt;
                 &lt;input type="radio" name="selectedBy"  
                 [(ngModel)]="selection.selectedBy" value="Office"&gt;Office
                 &lt;/label&gt;
              &lt;/div&gt;
           &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>