Difference between ng-model and data-ng-model

后端 未结 4 1097
谎友^
谎友^ 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:27

    They are the same. Angular strips the data- part from the attribute. From the docs:

    Angular normalizes an element's tag and attribute name to determine which elements match which directives... The normalization process is as follows:

    1. Strip x- and data- from the front of the element/attributes.
    2. Convert the :, -, or _-delimited name to camelCase.

提交回复
热议问题