2

I'm trying to get a <div> when you press a button in a table row appears only for that row. But <div> appears in all rows.

<tr ng-repeat="company in companiesList">
........
<div ng-if="company.verified == 'false'">
   <input type="button" ng-class="classBtnActivar" value="ACTIVAR" ng-click="activateCompany(company.id)">
       <div style="background-color: #d1d1d1; border-radius: 100px;" ng-if="company.id == idcompany">
           <p style="text-align: center">¿Quieres activar todos los comercios de la compañía?</p>
           <div style="text-align: center">
               <input type="button" ng-class="classBtnActivar" value="SI" style="text-align: center">
               <input type="button" ng-class="classBtnActivar" value="NO" style="text-align: center">
           </div>
       </div>
</div>

In controller:

$scope.activateCompany = function ( id ) {
    $scope.idcompany = id;
};
6
  • ng-if="company.verified==false", try this Commented Jul 29, 2016 at 8:05
  • i think his problem is with 2nd ng-if @tom moc Commented Jul 29, 2016 at 8:07
  • yes , may be.. @lban, provide complete code. Commented Jul 29, 2016 at 8:08
  • yes we can help out if u made a plunker iban Commented Jul 29, 2016 at 8:10
  • Can you show how does company.verified gets populated? Commented Jul 29, 2016 at 8:31

1 Answer 1

1

Make sure your HTML structure is correct (ng-if inside ng-repeat).

Update HTML to:

<tr ng-repeat="company in companiesList track by $index">
  ....
  <div ng-if="!company.verified">
     <input type="button" ng-class="classBtnActivar" value="ACTIVAR" ng-click="activateCompany(company.id)">
         <div style="background-color: #d1d1d1; border-radius: 100px;" ng-if="company.id == idcompany">
             <p style="text-align: center">¿Quieres activar todos los comercios de la compañía?</p>
             <div style="text-align: center">
                 <input type="button" ng-class="classBtnActivar" value="SI" style="text-align: center">
                 <input type="button" ng-class="classBtnActivar" value="NO" style="text-align: center">
             </div>
         </div>
  </div>
</tr>

Hope this help you!

Sign up to request clarification or add additional context in comments.

1 Comment

doesnt works!! thanks...the problem is with 2nd ng-if

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.