Differences between value and ngValue in Angular 5

前端 未结 5 434
轮回少年
轮回少年 2020-11-29 06:54

Today I realized about an unexpected (for me) behaviour of the reactive forms in Angular 5. The server was receiving from the app an string with the value "null" i

5条回答
  •  眼角桃花
    2020-11-29 07:57

    there is no much diffrence between value or ngValue.

    The only difference is that,

    when you have String as input then use value and

    when Object as input then use ngValue.

    const colors= ["Red", "Green", "Blue"];
    
    
    

提交回复
热议问题