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

angular.js - angular filter問(wèn)題
黃舟
黃舟 2017-05-15 17:13:27
0
1
842

下面是angular官網(wǎng)上講解filter的程式碼,有些地方?jīng)]看懂,辛苦各位大神賜教了。

<p ng-init="friends = [{name:'John', phone:'555-1276'},
                         {name:'Mary', phone:'800-BIG-MARY'},
                         {name:'Mike', phone:'555-4321'},
                         {name:'Adam', phone:'555-5678'},
                         {name:'Julie', phone:'555-8765'},
                         {name:'Juliette', phone:'555-5678'}]"></p>

Search: <input ng-model="searchText">
<table id="searchTextResults">
  <tr><th>Name</th><th>Phone</th></tr>
  <tr ng-repeat="friend in friends | filter:searchText">
    <td>{{friend.name}}</td>
    <td>{{friend.phone}}</td>
  </tr>
</table>
<hr>
Any: <input ng-model="search.$"> <br>
Name only <input ng-model="search.name"><br>
Phone only <input ng-model="search.phone"><br>
Equality <input type="checkbox" ng-model="strict"><br>
<table id="searchObjResults">
  <tr><th>Name</th><th>Phone</th></tr>
  <tr ng-repeat="friendObj in friends | filter:search:strict">
    <td>{{friendObj.name}}</td>
    <td>{{friendObj.phone}}</td>
  </tr>
</table>

介面顯示效果:


當(dāng)勾選Equality時(shí),下面的內(nèi)容不會(huì)顯示出來(lái)


程式碼中對(duì)應(yīng)的是

不懂它的filter:search:strict是怎麼運(yùn)作的?為什麼什麼都不能顯示了?

黃舟
黃舟

人生最曼妙的風(fēng)景,竟是內(nèi)心的淡定與從容!

全部回覆(1)
淡淡煙草味

勾選是有作用的,勾選上後為true,即嚴(yán)格比較,意思是說(shuō)你要輸入完全一樣的才能過(guò)濾出來(lái),你可以嘗試在Name only裡面輸入John 就能過(guò)濾出來(lái)了

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板