angular - Angular4 enums in templates -
interesting question. need use angualar4 templating enums.
aka.
<div class="small-12 columns compliance-freq__item" [ngclass]="getcompliancefrequencyclasses( compliancefrequency, licencecompliancefrequency.quarterly)"</div>
notice the
licencecompliancefrequency.quarterly
enum declaration follows
export enum licencecompliancefrequency { quarterly = "quarterly", monthly = "monthly" }
this gives me template error,
cannot read property quarterly of undefined.
i have tried intergrating template in many ways, modifiying component itself.
1) still quarterly of undefined error in template
get licencecompliancefrequency() { return licencecompliancefrequency; }
2) (screams licencecompliancefrequency not exportable element of file *.ts)
import {licencecompliancefrequency} '....'; public licencecompliancefrequency = licencecompliancefrequency;
any advice?
sorry, found answer myself.
the following works template. not nice have declare way , not able use enums globally, ut of well...
component code
import * licencecompliancefrequency '...'; public licencecompliancefrequency = licencecompliancefrequency;
Comments
Post a Comment