title: Get ID From Selected Checkbox on ng-change
body: <p>I'm attempting to extract the ID of checkbox when it is selected, but I can't seem to find a way that fits what I'm trying to do. </p>
  
  <p>First I have the HTML / Angular for the check boxes. The check boxes are generated by three tiers. First there's a service level, then the day of the week and then the service itself (which are what the check boxes are). The service level makes an accordion, the days of the week are loaded into tabs and the check boxes themselves come in as normal.</p>
  
  <pre><code>&lt;div class="delivery-rules"&gt;
      &lt;div class="panel-group" id="accordion"&gt;
          &lt;div class="panel panel-default" ng-repeat="level in settings.serviceLevels"&gt;
              &lt;div class="panel-heading"&gt;
                  &lt;h4 class="panel-title"&gt;
                      &lt;a data-toggle="collapse" data-parent="#accordion" href="#{{level.LevelTmsCode}}"&gt;{{level.LevelName}}&lt;/a&gt;
                  &lt;/h4&gt;
              &lt;/div&gt;
              &lt;div id="{{level.LevelTmsCode}}" class="panel-collapse collapse in"&gt;
                  &lt;div class="panel-body"&gt;
                      &lt;ul class="nav nav-tabs"&gt;
                          &lt;li id="{{day.Day}}-{{level.LevelTmsCode}}-tab" ng-repeat="day in settings.serviceDays"&gt;
                              &lt;a id="{{day.Day}}-{{level.LevelTmsCode}}" href="#tabContent-{{day.Day}}-{{level.LevelTmsCode}}" ng-click="settings.changeTab(day, level, $event)"&gt;{{day.Day}}&lt;/a&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                      &lt;div class="tabContent" id="tabContent-{{day.Day}}-{{level.LevelTmsCode}}" ng-repeat="day in settings.serviceDays"&gt;
                          &lt;h4&gt;{{day.Day}}&lt;/h4&gt;
                          &lt;div class="time-check" ng-repeat="service in settings.services"&gt;
                              &lt;input type="checkbox" value="None" ng-change="settings.showChecked(settings.rules, $event)" ng-model="settings.selected[$index]" class="time-check-input" id="{{level.LevelTmsCode}}-{{day.Day}}-{{service.TimeValidation}}" name="check"/&gt;
                              &lt;label for="{{level.LevelTmsCode}}-{{day.Day}}-{{service.TimeValidation}}" class="time-check-input"&gt;&lt;/label&gt; &lt;span&gt;{{service.TimeValidation}}&lt;/span&gt;
                          &lt;/div&gt;
                      &lt;/div&gt; 
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The arrays that build those check boxes, tabs and accordion are loaded with data from a standard http post request. Then once that is complete I place all the possible combinations of all three arrays into one big array and set their checked attribute to false. </p>
  
  <pre><code>// Get Service Levels to Build Delivery Rules Accordion
  settings.getDeliveryServices = function() {
      $http.get(resourceBase + "api/service/levels").success(function(data) {
          settings.serviceLevels = data;
          // Get Service Days
          $http.get(resourceBase + "api/service/days").success(function(days) {
              settings.serviceDays = days;
              // Build the Accordion
              setTimeout(() =&gt; settings.triggerClick(settings.serviceLevels), 500);
              $http.get(resourceBase + "api/service/services").success(function (services) {
                  settings.services = services;
                  // Build a collection of all possible rules
                  for (var a = 0; a &lt; settings.serviceLevels.length; a++) {
  
  settings.rulesTmsCode.push(settings.serviceLevels[a].LevelTmsCode + "-");
                  }
                  for (var b = 0; b &lt; settings.serviceDays.length; b++) {
                      settings.rulesDay.push(settings.serviceDays[b].Day + "-");
                  }
                  for (var c = 0; c &lt; settings.services.length; c++) {
  
  settings.rulesTime.push(settings.services[c].TimeValidation);
                  }
                  var allArrays = [settings.rulesTmsCode, settings.rulesDay, settings.rulesTime];
                  function allPossibleCases(arr) {
                      if (arr.length === 1) {
                          return arr[0];
                      } else {
                          var result = [];
                          var allCasesOfRest = allPossibleCases(arr.slice(1)); 
                          for (var i = 0; i &lt; allCasesOfRest.length; i++) {
                              for (var j = 0; j &lt; arr[0].length; j++) {
                                  result.push(arr[0][j] + allCasesOfRest[i]);
                              }
                          }
                          return result;
                      }
                  }
                  var uncheckedRules = allPossibleCases(allArrays);
                  for (var i = 0; i &lt; uncheckedRules.length; i++) {
                      settings.rules.push({
                          id: uncheckedRules[i],
                          checked: false
                      });
                  }
              });
          });
      });
  }
  </code></pre>
  
  <p>When each box is checked I'm trying to manipulate the combination array so that the selected combination is set to true.</p>
  
  <pre><code>// Check and Filter Rules to send
  settings.showChecked = function (object, $event) {
      for (var i = 0; i &lt; settings.rules.length; i++) {
          if (settings.rules.hasOwnProperty(i)) {
              if (typeof settings.rules[i].id == settings.selected[i]) {
                  settings.showChecked(settings.rules[i], settings.selected[i]);
              }
              if (settings.rules[i].id === settings.selected[i]) {
                  settings.rules[i].checked = true;
              }
          }
      }
      console.clear();
      console.log(settings.rules);
  }
  </code></pre>
  
  <p>Currently, nothing is set to true as I can't seem to be able to get the ID from the checkbox to compare it with the string stored in the ID value of the combination array. So basically I need the ID of the checkbox that was selected and I need to pass that through to the ng-change event.</p>