title: this.students.splice(index,1) is not changing in the UI [Angular]
body: <p>I am trying to delete a student object I have in a students array in my parent component. The student gets deleted by passing their name to the method. However, the view does not get updated. Here is my code for the delete method using <code>splice</code></p>
  
  <pre><code> deleteStudent(name: string) {
      for (var x = 0; x &lt; this.students.length; x++) {
        if (this.students[x].name === name) {
          this.students.splice(x, 1);
          this.students = [...this.students];
          console.log(x);
          return;
        }
      }}
  </code></pre>
  
  <p>Here is the full code for the parent class:</p>
  
  <pre><code>import { Component, OnInit } from "@angular/core";
  import { student } from "../../student";
  
  @Component({
    selector: "app-students",
    templateUrl: "./students.component.html",
    styleUrls: ["./students.component.css"]
  })
  export class StudentsComponent implements OnInit {
    students: student[] = [
      { name: "Marwa", level: "undergrad" },
      { name: "Heba", level: "undergrad" },
      { name: "Amal", level: "postgrad" }
    ];
  
    txt = "";
    toBeDeleted: student;
  
    public undergradsList = this.undergrads();
    constructor() {}
  
    ngOnInit() {
      this.undergrads();
      console.log(this.undergrads);
    }
    undergrads() {
      var Arrayres = new Array();
      for (var i = 0; i &lt; this.students.length; i++) {
        if (this.students[i].level === "undergrad") {
          Arrayres.push(this.students[i].name);
        }
      }
      console.log(Arrayres);
      return Arrayres;
    }
    deleteStudent(name: string) {
      for (var x = 0; x &lt; this.students.length; x++) {
        if (this.students[x].name === name) {
          this.students.splice(x, 1);
          this.students = [...this.students];
          this.undergradsList = this.undergrads();
          console.log(x);
          return;
        }
      }
      // const studentIndex = this.students.findIndex(e =&gt; e.name === name);
  
      console.log("hi delte");
    }
  }
  </code></pre>
  
  <p>Here is the code for the parent's HTML component:</p>
  
  <pre><code>&lt;h1&gt;{{ txt }}&lt;/h1&gt;
  &lt;app-under-grads
    (childEvent)="txt = $event"
    [studentList]="undergradsList"
    (studentDeletion)="deleteStudent($event)"
  &gt;
  &lt;/app-under-grads&gt;
  </code></pre>
  
  <p>Here is the code for my child component:</p>
  
  <pre><code>import { Component, OnInit, Input, EventEmitter, Output } from "@angular/core";
  import { student } from "../../student";
  
  @Component({
    selector: "app-under-grads",
    templateUrl: "./under-grads.component.html",
    styleUrls: ["./under-grads.component.css"]
  })
  export class UnderGradsComponent implements OnInit {
    @Input() public studentList;
    @Output() public childEvent = new EventEmitter();
  
    constructor() {}
  
    ngOnInit() {
      console.log(this.studentList);
    }
  
    sendInfo() {
      this.childEvent.emit("Hello I am sending this to the parent");
    }
  
    @Output() public studentDeletion = new EventEmitter&lt;string&gt;();
    delete(name: string) {
      //  console.log("delete it");
      this.studentDeletion.emit(name);
      console.log(name);
    }
  }
  </code></pre>
  
  <p>Here is the HTML of my child component which is being rendered on the screen. studentList is an array of strings of names</p>
  
  <pre><code>&lt;h2&gt;UnderGrads&lt;/h2&gt;
  &lt;div&gt;
    &lt;ul&gt;
      &lt;li *ngFor="let x of studentList"&gt;
        {{ x }} &lt;button (click)="delete(x)"&gt;X&lt;/button&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>