国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - angularjs {{}}疑問
PHPz
PHPz 2017-05-15 16:51:54
0
4
656

在html的界面中 {{a}}為什么輸出的是

html<span class="ng-binding ng-scope">
4
</span>

而我期望的是

html4

是否有遇到過的大神幫忙解惑~

PHPz
PHPz

學習是最好的投資!

Antworte allen(4)
為情所困

引自官網(wǎng):

The ngBind attribute tells Angular to replace the text content of the
specified HTML element with the value of a given expression, and to
update the text content when the value of that expression changes.

意思就是ngBind會告訴angular去將你寫的表達式替換成一個特殊的html元素。

而這個特殊的html元素就是那個帶class的span了,

雙花括號{{}}ngBind是一樣的,實際上是一個directive,只在適用范圍有稍許區(qū)別

官方文檔ngBind

淡淡煙草味

AngularJs ng-bind 輸出的HTML值肯定不會單單是4。要不然輸出值的位置如何控制?

洪濤

a這個變量的值是怎么樣被賦進去的?
一般來說$scope.a=4;
{{a}}的輸出結(jié)果就是4的呀。

伊謝爾倫

謝邀。在angular的源碼中可以看到 https://github.com/angular/angular.js/blob/master/src/ng/compile.js#L1...
其實就是為了給這個"頂級文本節(jié)點"綁定數(shù)據(jù)用的

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage