Difference between ng-model and data-ng-model

后端 未结 4 1094
谎友^
谎友^ 2020-12-29 19:50

I am new with the AngularJs. Can anyone say the difference between ng-model and data-ng-model?

With ng-model

First          


        
4条回答
  •  盖世英雄少女心
    2020-12-29 20:45

    There is no difference between ng-model and data-ng-model if you see in terms of AngularJs.

    Actually, 'data' used as prefix to validate HTML5 validation. So, it is good practice to use data-ng-model, however, you can use ng-model as well. There is no problem in that also.

    Both have the same meaning and both have the same output:

    With ng-model

    First Name  :  
    Second Name :    
    

    With data-ng-model

    First Name  :  
    Second Name :    
    

提交回复
热议问题