I am fetching data from the rest service in angularjs and the data is shown in the form of a table using ng-repeat. I am creating a Activate/Deactivate button based on the value of the variable,say if the value is true then show Activate button else Deactivate button. here is my controller
$scope.btnText='Deactivate';
$scope.active={};
FetchDomainService.get(function(
response) {
$scope.domains = response;
$scope.active=$scope.domains[0].isActive;
if( $scope.active==='true'){
$scope.btnText==='Activate';
}
});
and here is my html code
<tr ng-repeat="domain in domains">
<td>{{domain.clientId}}</td>
<td>{{domain.jndisys}}</td>
<td>{{domain.buildVersion}}</td>
<td>{{domain.domainUuid}}</td>
<td>{{domain.isActive}}</td>
<td>
<button class="btn"
ng-click="">
<span class="glyphicon glyphicon-pencil"></span>{{btnText}}
</button>
</td>
</tr>
Now the issue is....how can i change the btn text in every row..I am able to change it in all rows but not on a single row.i need to check every row and then change button text. the isActive is an boolean and if it is true then the button text is 'Activate' and if the value of isActive is false then the button text is Deactivate.