Ng - if it costs 500 watchers - performance

I have duplicate duplicate data. - Some of data.image (src) is null, and those with src = null are not repeated.

I solved this with a simple ng-if.

<div ng-repeat="data in data">

      <div class="ImageContainer">
        <img ng-src="{{::data.image}}" ng-if="data.image != null" />
      </div>
      <div class="LabelContainer">
        <p>
          {{::data.label}}
        </p>
      <div>
<div>

but from debugging, I noticed that it cost me about 500 watchers. Any obvious way to accomplish what I'm trying without ng-if or the main JS vanilla function?

+4
source share
2 answers

You can apply one-way snapping to ng - if you can reduce the number of watchers.

@DoctorMick, , , . , , .

+1

, , , .

+2

All Articles