I have this enum (I\'m using TypeScript) :
export enum CountryCodeEnum {
France = 1,
Belgium = 2
}
I would like to build a
One more solution if you don't want to create a new pipe. You could also extract keys into helper property and use it:
@Component({
selector: 'my-app',
providers: [],
template: `
`,
directives: []
})
export class App {
countries = CountryCodeEnum
constructor() {
this.keys = Object.keys(this.countries).filter(k => !isNaN(Number(k)));
}
}
Demo: http://plnkr.co/edit/CMFt6Zl7lLYgnHoKKa4E?p=preview
Edit:
if you need the options as numbers instead of strings:
[value] with [ngValue].map(Number) after .filter(...)