title: Execute if function if checkbox is checked angular.js
body: <p>How can I execute a function when a check box is checked in angular js. I have seen a few answers on stack overflow regarding this but I cannot seem to implement them on my scenario</p>
  
  <p>my code:</p>
  
  <pre><code>&lt;div ng-controller="MyCtrl"&gt;
   &lt;div class="checkbox"&gt;
          &lt;label&gt;
          &lt;input type="checkbox" ng-model="thirtyDay" ng-click="changeAxis()"&gt;
          Last 30 Days
          &lt;/label&gt;
           &lt;/div&gt;
           &lt;div class="checkbox"&gt;
          &lt;label&gt;
          &lt;input type="checkbox" ng-model="wholeTimeline" ng-click="changeAxis()"&gt;
          Whole Timeline
          &lt;/label&gt;
           &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>js.</p>
  
  <pre><code>var myApp = angular.module('myApp',[]);
  
  function MyCtrl($scope) {
     function changeAxis(){
            if ($scope.thirtyDay) {
                      alert("checked 30");
                  }
            else if($scope.wholeTimeline) {
                      alert("checked whole");
                  }
  
          };
  }
  </code></pre>