Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng-repeat ignores immediate ng-if

I have been working with Angular JS for long time now, but just now faced a strange issue where ng-if is simply gets ignored with ng-repeat.

This is the sample and simple code which doesn't work as expected

<ul ng-repeat="detail in details">
  <span ng-if="2 == 3"> <!-- This should block the next tags to execute-->
    <li>{{detail.name}}
      <ul ng-repeat="detailed in details.name">
        <li>{{detailed.prof}}</li>
      </ul>
    </li>
  </span>
  <span ng-if="2 === 2"> <!-- Instead this should get print -->
    Print this (Updated)
  </span>
</ul>

Here is my plunkr : https://plnkr.co/edit/xy4Qyd4tXm6kWROiaFVR?p=preview

like image 577
undefined Avatar asked Jan 10 '17 06:01

undefined


1 Answers

use this version

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>

or use ng-if -> ng-show

like image 181
Gurpreet Singh Avatar answered Oct 03 '22 14:10

Gurpreet Singh