How to use a typescript enum value in an Angular2 ngSwitch statement

后端 未结 9 669
深忆病人
深忆病人 2020-12-07 16:13

The Typescript enum seems a natural match with Angular2\'s ngSwitch directive. But when I try to use an enum in my component\'s template, I get \"Cannot read property \'xxx

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 16:43

    as of rc.6 / final

    ...

    export enum AdnetNetworkPropSelector {
        CONTENT,
        PACKAGE,
        RESOURCE
    }
    
    
    export class AdnetNetwork { private adnetNetworkPropSelector = AdnetNetworkPropSelector; private propSelector = AdnetNetworkPropSelector.CONTENT; }

提交回复
热议问题