Trouble reading into an array of objects


#1

Ok, so I have this simple form here:

<form (ngSubmit)="logForm()">
      <ion-item>
        <ion-label>Name</ion-label>
        <ion-input type="text" [(ngModel)]="name" name="Name"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label>Species</ion-label>
        <ion-textarea [(ngModel)]="species" name="species"></ion-textarea>
      </ion-item>
	  <ion-item>
        <ion-label>Age</ion-label>
        <ion-textarea [(ngModel)]="age" name="age"></ion-textarea>
      </ion-item>
	  <ion-item>
        <ion-label>Sex</ion-label>
        <ion-textarea [(ngModel)]="sex" name="sex"></ion-textarea>
      </ion-item>
	  <ion-item>
        <ion-label>Rego</ion-label>
        <ion-textarea [(ngModel)]="rego" name="rego"></ion-textarea>
      </ion-item>
	  <ion-item>
        <ion-label>Phone</ion-label>
        <ion-textarea [(ngModel)]="ph" name="ph"></ion-textarea>
      </ion-item>
      <button ion-button type="submit" block>Add Pet</button>
    </form>

I can read the values fine. However, the problem is I’m having trouble setting two of the values to numbers for a provider.

//name:string, species:string, age:number,
// sex:string, rego:number, phone:string

logForm( petService: PetService) {

		parseInt(this.age)
		parseInt(this.rego)
		
		//this.name,this.species,this.age,this.sex,this.rego,this.ph
		this.a = [this.name,this.species];
		this.b = [this.age];
		this.c = [this.sex];
		this.d = [this.rego];
		this.e = [this.ph];
		
		this.peta = this.a.concat(this.b,this.c,this.d,this.e);
		
		console.log("Peta = ");
		console.log(this.peta[0]);
		if (typeof this.peta[2] === 'number'){
			alert("There's numbers!");
			
			
		}
		//petService.add(this.peta);
		console.log("Peta = ");
		console.log(this.peta);
		
		
	  }

^^; I swear I’m blind.


#2

I found the problem so I’ll post it here in case folk get the same thing.

this.b = [parseInt(this.age)];

Parseint returns a value, it doesn’t make the variable an int.