angular.js - ng-bind does not display data, but ng-model can?
为情所困
为情所困 2017-05-15 16:53:49
0
2
589

The code is as follows

<input type='text' ng-model='cdkey.name'>   {{cdkey.name}}

The input box of ngModel displays the data correctly, but the data is not displayed in the double brackets on the right. What is the reason for this?

Additional: ng-bind can also be displayed correctly, but double curly braces cannot. Is the rendering method of ngBind and double curly braces different? ? ?

为情所困
为情所困

reply all(2)
洪涛

1. If input里面的ng-model绑定的数据模型不是一个Object, then this should not happen.
2.ng-bind{{}}The results of rendering data are different when the data model to which they are bound is an object.
3. I wrote a demo, you can have a look.

给我你的怀抱
<input type='text' ng-model='cdkey.name' value="cdkey.name">

The value of the input tag should of course be placed in the attribute valuel.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template