I have a scenario where I am displaying a list of users with two buttons for Start and End using the ng-repeat code:
<div class="list-group" ng-repeat="patient in patients" >
<a href="#" class="list-group-item" ng-click="chatNow(patient.id);" >{{patient.firstname}} {{patient.lastname}}</a>
<button class="btn btn-success" ng-click="chatNow(patient.id);">{{btnLabel}}</button>
<button class="btn btn-danger" ng-click="endVideo(patient.appointmentId);">End Consultation</button>
</div> <!-- list-group ends -->
This list is automatically refreshed every 30 seconds using $http.get.
The btnLabel is initially set to 'Start Consultation' in the Controller:
var t = $scope;
t.btnLabel = 'Start Consultation';
When chatNow is called on ng-click, the btnLabel changes to 'In Progress':
t.chatNow = function(jobId) {
t.btnLabel = 'In Progress';
};
Now, I also want the label to change based on the chatStatus property:
{{patient.chatStatus == 22 ? 'Start Consultation':'In Progress'}}
The challenge I am facing is combining both of these conditions so that the label changes on click as well as when there is a change in chatStatus. Any assistance would be highly appreciated.
Thank you for any further pointers.