Dartlang: Using enums in Angular2 templates Dartlang: Using enums in Angular2 templates dart dart

Dartlang: Using enums in Angular2 templates


We're working on bringing formal support, but you can always add a getter for now:

enum MyEnum {  stateA,  stateB,}class MyComponent {  MyEnum get stateA => MyEnum.stateA;}


Use the exports property of your Component class. Copied from here in the AngularDart Guide.

enum MyEnum { foo, bar, baz }@Component(  selector: 'example',  exports: const [MyEnum],  template: '<p>{{MyEnum.bar}}</p>',)class Example {}