Using this data model code in Angular:
export class Car {
brand: string;
year: number;
nameOfModel() => {
// I need return here the name of class as a string: 'Car'
}
}
Can I somehow get back the name of the class as a string?
Using this data model code in Angular:
export class Car {
brand: string;
year: number;
nameOfModel() => {
// I need return here the name of class as a string: 'Car'
}
}
Can I somehow get back the name of the class as a string?
This works for me:
export class Car {
brand: string;
year: number;
nameOfModel: string = () => {
return Car.name
}
}