title: Delete an item(Object) from an array using ng-if
body: <p>I am trying to remove item using ng-if and ng-else-if.
  &quot;ng-if=&quot;navItem.gbn.indexOf('12345') !== -1&quot; is true then array item only show contains('12345') items.
  but the item still remain in array so I think ng-else-if is not working.
  I don't know how to delete it.</p>
  <p>I have the following Angular code:</p>
  <pre><code>    &lt;div ng-controller=&quot;PIDAEController&quot;&gt; 
          &lt;div class=&quot;container-fluid&quot; style=&quot;padding-top:30px;&quot;&gt;
              &lt;div class=&quot;row&quot;&gt;
                  &lt;div class=&quot;col-lg-2 col-md-3 col-xs-6 tubmbimg&quot; ng-repeat=&quot;navItem in navItems | Fpage: curPage * pageSize | limitTo:pageSize&quot; ng-if=&quot;navItem.gbn.indexOf('12345') !== -1&quot;&gt;
                          &lt;a class=&quot;thumbnail border&quot; href=&quot;#/item/{{navItem.site}}&quot;&gt;
                              &lt;div class=&quot;b-marjin&quot;&gt;
                                  &lt;span align=&quot;center&quot; class=&quot;label label-primary full-width&quot; &gt;{{ navItem.gbn }}&lt;/span&gt;
                              &lt;/div&gt;
                              &lt;div&gt;
                                  &lt;img style=&quot;border: 1px solid black;&quot; class=&quot;img-responsive full-width&quot; src=&quot;{{navItem.pimg}}&quot; alt=&quot;&quot;&gt;
                              &lt;/div&gt;
                              &lt;div align=&quot;center&quot; class=&quot;under-block&quot;&gt;
                                  &lt;span title=&quot;{{ navItem.pname }}&quot; align=&quot;center&quot;&gt;{{ navItem.pname2}}&lt;/span&gt;
                              &lt;/div&gt;
                          &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div ng-else-if=&quot;navItems.splice(navItem, 1)&quot;&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      
      
  angular.forEach(item, function (value, key) {
      var keepGoing = true;
      if(keepGoing) {
          if(value.gbn.indexOf(&quot;11600&quot;) != -1) {
              $scope.initialized = true;
              $scope.navItems = item;
              $scope.curPage=0;
              $scope.pageSize=20;
              $scope.numberOfPage = Math.ceil(item.length / $scope.pageSize);
              keepGoing = false;
          }
          else {
              $scope.navItems.splice(key, 1);
          }
      }
  });
  </code></pre>