I have this code:
<label ng-repeat="day in days">
    <input type="checkbox" ng-model="activityDays[$index]" /> {{day}}
    <br />
</label>
How can I change text of label when checked?
I have this code:
<label ng-repeat="day in days">
    <input type="checkbox" ng-model="activityDays[$index]" /> {{day}}
    <br />
</label>
How can I change text of label when checked?
 
    
     
    
    Using JavaScript, you can loop through the input's  parent's children, and change its .data if its day.
var checkbox = document.querySelector('input[type=checkbox]');
checkbox.addEventListener('change', function() {
  if (this.checked == true) {
    for (i = 0; i < this.parentNode.childNodes.length; i++) {
      if (this.parentNode.childNodes[i].data !== undefined) {
        if (this.parentNode.childNodes[i].data.trim() == 'day') {
          this.parentNode.childNodes[i].data = 'night'
        }
      }
    }
  } else {
    for (i = 0; i < this.parentNode.childNodes.length; i++) {
      if (this.parentNode.childNodes[i].data !== undefined) {
        if (this.parentNode.childNodes[i].data.trim() == 'night') {
          this.parentNode.childNodes[i].data = 'day'
        }
      }
    }
  }
})<label ng-repeat="day in days">
  <input type="checkbox" ng-model="activityDays[$index]" />day
  <br />
</label>