Timeline for How to use a typescript enum value in an Angular2 ngSwitch statement
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 22, 2021 at 12:20 | comment | added | GeorgiG | Man, you are lifesaver! This increases readability immensely. For newbies like me - don't forget the MyEnum = MyEnum; line, without it switch cases don't work! | |
Nov 17, 2017 at 21:49 | comment | added | ObjectiveTC | I had to define the enum in an external file using "export enum MyEnum{...}". Then in the component file, import 'MyEnum' from that external file, and continue with the solution above for 'MyEnum = MyEnum" etc. | |
Nov 17, 2017 at 12:05 | comment | added | ForestG | how can you reuse the same enum in a different component? | |
Oct 2, 2017 at 23:00 | history | answered | ObjectiveTC | CC BY-SA 3.0 |