Question: I iam using angular 8 and i'm beginner so i need a help I want to delete an item from array using (click)="deleteEmployee(el.id)" im trying to use splice but i have an error their :

this is Component.ts code :

```
  employee: Employe;
  id: number;

  _employesArray:Employe[]=[];
  headElements = ['ID', 'Nom', 'Prenom', 'Email', 'Telephone', 'CompteStatut'];

  constructor(private route: ActivatedRoute, private http:HttpClient, private employeservice:EmployeService, private router: Router) {

   }

  ngOnInit() {
    this.employee = new Employe();

    this.id =this.route.snapshot.params['id'];

    this.employeservice.getEmployee(this.id)
      .subscribe(data => {
        console.log(data)
        this.employee = data;
      }, error => console.log(error));
    this.reloadData();
  }

  reloadData() {
    this.employeservice.getEmp().subscribe(
      data=>{
        this._employesArray=data;

      },
      err=>{
        console.log("An error has occured")
      }
    );

  }

  deleteEmployee(id: any) {
    this.employeservice.deleteEmployee(this.id)
      .subscribe(data =>{
      this._employesArray.splice(this._employesArray.indexOf(this.id), 1);
      this.reloadData();
      },

       error => console.log(error));

  }

```

Answer: 
An empty string cannot be parsed as an `int`. As others have mentioned, you can use `int.TryParse` which accepts a string as the first parameter and an `out int` as the second parameter, which holds the parsed value. You could do this:

```c#
int overallTotal = 0;
int a = 0;
int b = 0;

// TryParse returns a bool
// If either of these fails, the variable a or b will keep the default 0 value
int.TryParse(txtSubtotal.Text, out a);
int.TryParse(txtAdvancePayment.Text, out b);

// Sum a and b
overallTotal = a + b;

```

If you want to show an error to the user that one or both fields isn't a valid integer, you can assign a `bool` variable such as `var aIsNumber = int.TryParse(...)` and then check if `aIsNumber` or `bIsNumber` is `false`. If so, then `a` and/or `b` could not be parsed to an `int`.
You could use [Int32.TryParse](https://learn.microsoft.com/en-us/dotnet/api/system.int32.tryparse?view=netframework-4.8). 

`Int32.Parse` attempts to convert the string representation of a number to its 32-bit signed integer equivalent and returns value indicates whether the operation succeeded. This would mean, in case your textbox is empty or contains a invalid numeric representation, and the method would return false since it would not be able to convert it to `int32`

For example

```
  if(Int32.TryParse(txtsubtotal.Text,out var a) 
                   && Int32.TryParse(txtadvancepayment.Text,out var b))
  {
         // Code which requires a and b  
  } 

```