Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

110
Vistas
Content of "Ng-If ="0" <div>" shows on un-"collapse"

The content of the ng-if still shows if I click the button. But I want it only to show in a specific situation. In another situation the button should unhide a different <div>

I thought the part after ng-if gets removed in the DOM, so I am wondering why it is even able to show up.

<tr>
  <td>{{approval_item.requested_for}}</td>
  <td><a data-toggle="collapse" data-target=".{{approval_item.document_id_number}}"><i class="fa fa-trash"></i></a></td>
</tr>

<div ng-if="0">
  <tr class="hide-table-padding collapse {{approval_item.document_id_number}}">
    <td colspan="5">
      <tr class="collapse {{approval_item.document_id_number}}">
        <td><b>Item / Service</b></td>
        <td><b>Quantity</b></td>
        <td><b>One-time Price</b></td>
        <td><b>Monthly</b></td>
        <td><b>Yearly</b></td>
      </tr>
      <tr class="collapse {{approval_item.document_id_number}}" ng-repeat="requested_item in approval_item.request_ritms">
        <td><a href="{{requested_item.link}}">{{requested_item.name}}</a></td>
        <td>{{requested_item.quantity}}</td>
        <td>{{requested_item.price_string}}</td>
        <td>{{requested_item.price_monthly_string}}</td>
        <td>{{requested_item.price_yearly_string}}</td>
      </tr>
      <tr class="collapse {{approval_item.document_id_number}}">
        <td></td>
        <td></td>
        <td><b>One-time Total</b></td>
        <td><b>Monthly Total</b></td>
        <td><b>Annually Total</b></td>
      </tr>
      <tr class="collapse {{approval_item.document_id_number}}">
        <td></td>
        <td></td>
        <td>{{approval_item.price_string}}</td>
        <td>{{approval_item.price_monthly_string}}</td>
        <td>{{approval_item.price_yearly_string}}</td>
      </tr>
    </td>
  </tr>
</div>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The problem is that div can't be a child of table. If you want to hide the row, you should remove the div and move the ng-if into the tr itself.

Do

angular.module('myApp', [])
  .controller("Ctrl_List", ["$scope", function(s) {}])
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>

<div ng-app="myApp">
  <div class="container" ng-controller="Ctrl_List">
    <table>
      <tr>
        <td>
          row 1
        </td>
      </tr>
      <tr ng-if="0">
        <td>
          row 2
        </td>
      </tr>
    </table>
  </div>
</div>

Don't

angular.module('myApp', [])
  .controller("Ctrl_List", ["$scope", function(s) {}])
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>

<div ng-app="myApp">
  <div class="container" ng-controller="Ctrl_List">
    <table>
      <tr>
        <td>
          row 1
        </td>
      </tr>
      <div ng-if="0">
        <tr>
          <td>
            row 2
          </td>
        </tr>
      </div>
    </table>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda