I\'ve searched around but can\'t seem to find an answer for this, hopefully you can help. How can I add an enum to Image? This is what I would like ideally but I get an error.>
program.ts:
enum Status {
Deleting,
Editing,
Existing,
New
}
export class Program {
static readonly Status = Status;
readonly Status = Program.Status;
title: string;
status: Status;
constructor(init?: Partial) {
Object.assign(this, init);
}
}
Usage:
let program = new Program({ title: `some title` });
program.status = Program.Status.New;
or
program.status = program.Status.New;
Added benefit for Angular 2+ users: this can be used in templates
Only display if status of the program is New