If i want to leverage enums which exist outside the scope of my component.
export enum Template { Foo = 0, Bar = 1, Fuzz = 2 }
but when trying to leverage it my template file, it will throw an error.
<div *ngIf="model.type == Template.Foo"></div>
for example. When serving the application, it does not understand what Template is. If I create a property in my component, Template, as follows it will work:
Template = Template
essentially creating the enum inside the scope of the component as its own property. I just dont like it though, it feels dirty and not right.
I thought there was a property in the Component decorator to essentially add exports for the template, but that does not seem to be the case.
Is the way I am doing it correct, or is there a way which doesnt feel like a hack?
Thank you.
Edit The reason I asked this, is that the AngularDart way of doing it is through an exports
property in the Component Annotation. See: https://webdev.dartlang.org/api/angular/angular/Component/exports and was not sure if this is just a divergence of technology or if there was an option that does similar without property assignment.