'use strict';

angular.module('app.search')
  .component('courseSearchResult', {
    templateUrl: 'search/result.html',
    bindings: {
      course: '<',
      updateSelection: '&',
      selections: '='
    },
    controller: ResultController
  });

ResultController.$inject = ['$http'];

function ResultController($http) {
  var vm = this
  vm.sections = {};

  vm.$onInit = function() {
    vm.selectedSections = vm.selections;
    vm.course.sections.forEach(function(section) {
      $http.get(section.href)
        .then(function(response) {
          vm.sections[section.id] = response.data;
        });
    });
  };

  vm.select = function (section, $event) {
    // vm.selectedSections[section.id] = !vm.selectedSections[section.id];
    vm.updateSelection({section: section});
  };
}

@@ -379,16 +379,17 @@
 function
+ 
 () %7B%0A   
@@ -465,16 +465,17 @@
 function
+ 
 (section
@@ -530,16 +530,17 @@
 function
+ 
 (respons
@@ -672,10 +672,63 @@
     
-//
+if ($event) %7B%0A      $event.stopPropagation();%0A    %7D%0A   
  vm.

Fix checkbox issues