I am looking for a way to initialize an array of type Passenger
which its number of elements is equal to the value of variable count
. How can I do it in ngOnInit()
???
This is the Passenger
model:
export class Passenger {
constructor(
public ageCategory: string = '',
public name: string = '',
public lastName: string = '',
public Ssn: string = '',
public birtDate: NgbDate = new NgbDate(0, 0, 0),
public passportDate: NgbDate = new NgbDate(0, 0, 0),
public gender: string = '',
public passportCountry: string = ''
) { }
}
And this the content of home.component.ts
:
import { Passenger } from '../../models/passenger';
export class HomeComponent implements OnInit {
passengers: Passenger[];
count: number = 5;
constructor() { }
ngOnInit() {
}
}