title: Trigger Event Click upon page load
body: <p>I do not know why I can not trigger a click event on my controller upon page load. What I want is the checkboxed to be click literally. </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html &gt;
  
    &lt;head&gt;
      &lt;link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
  
    &lt;body ng-app="ngToggle"&gt;
      &lt;div ng-controller="AppCtrl"&gt;
          &lt;input type="checkbox" ng-model="dean" ng-click="btnChange($event, values, 1)" id="one" name="one" class="here" &gt;
          &lt;input type="checkbox"  ng-model="armada" ng-click="btnChange($event, values, 2)" id="two" name="one" class="here" &gt;
          &lt;!--&lt;p ng-repeat="btn in btns"&gt;--&gt;
          &lt;!--  &lt;input type="checkbox" ng-model="btn.bool" class="here" &gt; {{ btn.value }}--&gt;
          &lt;!--&lt;/p&gt;--&gt;
          {{btn  }}
          {{values  }}
      &lt;/div&gt;
      &lt;script type="text/javascript"&gt;
          angular.module('ngToggle', [])
              .controller('AppCtrl',['$scope', function($scope){
              $scope.btns = [{}, {}, {}];
              $scope.values = [];
              $scope.btnChange = function(event, model, val){
                _this = angular.element(event.target);
                x = _this.prop("checked");
                if(x){
                  model.push(val);
                }else{
                  index = model.indexOf(val);
                  model.splice(index, 1);
                }
              };
              angular.element("#one").triggerHandler("click");
          }]);
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the plunker: <a href="http://plnkr.co/edit/7DpCvkKLlKhRc3YwFTq0?p=preview" rel="nofollow">http://plnkr.co/edit/7DpCvkKLlKhRc3YwFTq0?p=preview</a></p>