30 seconds of angular
Star
✨✨ New to Angular? Check out interactive Angular Codelab ✨✨

Accessing Enums in template

Enums are great but they are not visible in Angular templates by default.
With this little trick you can make them accessible.

enum Animals {
  DOG,
  CAT,
  DOLPHIN
}

@Component({
  ...
})
export class AppComponent {
  animalsEnum: typeof Animals = Animals;
}

Interactive demo