How to use enum in Angular 2 templates

后端 未结 2 990
我在风中等你
我在风中等你 2021-02-05 00:37

I am trying to use enum in angularjs 2 templates. Below is my code

@Component({
    selector: \'test\',
    template: `
    &
2条回答
  •  一向
    一向 (楼主)
    2021-02-05 00:55

    The simple way to use an Enum in a template is

    @Component(...)
    export class MyComp {
      public MyEnum: any = MyEnum;
    }
    

    Then in template:

    
    

提交回复
热议问题