I am trying to use the enum value to set the selected HTML attribute value:
export enum MyEnum { FirstValue, SecondValue } export function MyEnumAware(constructor: Function) { constructor.prototype.MyEnum = MyEnum; } @MyEnumAware @Component({ templateUrl: "./lot-edit.component.html", styleUrls: ["./lot-edit.component.css"], }) export class LotEditComponent implements OnInit { @Input() myEnumValue: MyEnum ;
}
<td><input name="status" type="radio" [value]="MyEnum.FirstValue" [(ngModel)]="myEnumValue"></td> <td><input name="status" type="radio" [value]="MyEnum.SecondValue" [(ngModel)]="myEnumValue"></td>
however I get "Can't read property" FirstValue "from undefined"
Is it possible to use the enum value as the value of html attributes?
enums angular typescript
wonbyte Feb 26 '17 at 3:19 2017-02-26 03:19
source share