how to make class in angular code example
Example 1: create model class angular
export class Person {
constructor(
public name: string,
public lastName: string,
public age:number
) {}
}
.
.
public people: Person[];
constructor(){
this.people = [
new Person ('Carla','Smith', 20 ),
new Person ('Carlos','Smith', 25 ),
new Person ('Andrea','Johnson', 23 ),
];
}
Example 2: create class angular
export class Person {
constructor(
public name: string,
public lastName: string,
public age:number
) {}
}
.
.
public people: Person[];
constructor(){
this.people = [
new Person ('Carla','Smith', 20 ),
new Person ('Carlos','Smith', 25 ),
new Person ('Andrea','Johnson', 23 ),
];
}