Metadata for Typescript Models

8 views
Skip to first unread message

RAVIKIRAN GUTURU

unread,
Jun 30, 2020, 2:40:50 PM6/30/20
to Angular and AngularJS discussion
I am using Material Module with Angular 8.

How can we define metadata for typescript models and how do we access this metadata both in component HTML and ts file.

export class Qualifier {

    [Name="Name"]
    [Order=1]
    [Type="String"]
    public name: string;
    [Name="Qualifier Description"]
    [Order=3]
    [Type="String"]
    public description: string;
    [Name="Usage"]
    [Order=2]
    [Type="Number"]
    public usage: number;
    
}

I am using this model as data source for mat-table and i need my own column headers, Display Order and show mat-menu based on datatype.

Please let me know.

Reply all
Reply to author
Forward
0 new messages