Initial ng-model value not set in select

前端 未结 4 1321
庸人自扰
庸人自扰 2021-02-05 06:46

I have an enum (I code using TypeScript):

export enum AddressType
{
    NotSet = 0,

    Home = 1,
    Work = 2,
    Headquarters = 3,

    Custom = -1,
}
         


        
4条回答
  •  我寻月下人不归
    2021-02-05 07:21

    I happens because you didn't initiated selected value. Try to set init value with ng-init:

    
    

    See this Demo Fiddle where we have 2 combos with and without init value. You can see that one combo HTML seems like:

    
    

    The proper one:

    
    

提交回复
热议问题