1
關於Angular JS性能的快速問題。AngularJS-1使用ng-if語句或兩個指令的指令?
我有一個ng-repeat列出了搜索結果的負載。我使用指令/模板來提取每個搜索項。
使用ng-if語句包裝兩個指令或使用一個指令並在其中包含多個ng-if語句並使用表達式或語句會更好嗎?
E.G. NG-if語句包裹兩條指令:
<div ng-repeat>
<directive-1 ng-if="this"></directive-1>
<directive-2 ng-if="that"></directive-2>
</div>
OR
<div ng-repeat>
<directive-1></directive-1>
</div>
和指令-1,您內...
<img src="1" ng-if="this">
<img src="2" ng-if="that">
<span>{{title || title2}}</span>
etc...