External enums

How to configure multiple enums and import them wherever you want? Anyone with an example? Also, I would like to know if it is possible to load them dynamically by REST call?

Well, first part wasn´t that hard after all, sharing snippets…

in enums.ts

[code]export enum RoleType{
Admin = 1,
User = 2
}

export enum SomeOtherType{
Type1 = 1,
Type2 = 2
}[/code]

in somepage.ts

[code]import * as Enums from ‘./somedirectory/enums/enums’;

constructor()
{
console.log(Enums.RoleType.Admin);
}

[/code]

1 Like