jeudi 16 juin 2022

Reading properies of an typecript class at runtime. Something like the reflection in C# or in JAVA

I've got a .ts file which contains many classes like below (Angular Project). The Classes auto generated from backend classes.

export class User {
  name: string;
  lastName: number;
  userCode: string;

}

Now, I want to read this class and its properties by its name. Then I will create the Angular input elements with this data.

For Instance (pseudo code):

let className = 'User';
  let listOfProperties = reflectObject(className)




Aucun commentaire:

Enregistrer un commentaire