title: How to filter an array and return the entire object - Angular
body: <pre><code>export class ResultComponent {
      students: AdmissionFormData[]
  
      constructor(private adStudent: AdmissionFormService) {
          adStudent.adFormGet().subscribe(
              x =&gt; this.students = x
          )
      }
  
      onSubmit(value) {
  
      }
  }
  </code></pre>
  
  <p>In the students array, I have the data.  And onSubmit is the function and value is the parameter "roll" </p>
  
  <p>And the HTML File:</p>
  
  <pre><code>&lt;div class="form"&gt;
  &lt;div class="col-md-5 offset-md-3"&gt;
    &lt;div class="card"&gt;
        &lt;div class="card-header text-center"&gt;
            &lt;h3 id="form_name" &gt;Search Result&lt;/h3&gt;
        &lt;/div&gt;
  
        &lt;div class="card-block"&gt;
            &lt;form (ngSubmit)="onSubmit(f.value)" #f="ngForm" &gt;
                &lt;div class="form-group"&gt;
                  &lt;label for=""&gt;Roll&lt;/label&gt;
                  &lt;input
                  type="number" 
                  ngModel
                  name="reg" 
                  #reg="ngModel" 
                  [min]="99999"
                  placeholder="Ex: 224697"
                  class="form-control"&gt;
                  &lt;p class="text-danger" *ngIf="!reg.valid &amp;&amp; reg.touched"&gt;Roll Should have at least 6 letter&lt;/p&gt;
                &lt;/div&gt;
                &lt;input 
                type="submit"
                value="Search" 
                class="btn btn-block btn-outline-success"&gt;
            &lt;/form&gt;
        &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p><a href="https://i.stack.imgur.com/HdTeY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HdTeY.png" alt="The array"></a></p>
  
  <p>I want to search for the roll in this array and if I find a match then I would like to return the whole array and use it somewhere.</p>
  
  <p>Now how can I do that?</p>
  
  <p>I think I made a mistake before so I edit the question. 
  Please forgive me I'm new here.</p>