title: default click on first element in ng-click angularjs
body: <p>I have written below piece of code for clicking the first element in ng-repeat to make it active by default :</p>
  
  <pre><code>&lt;ul id="thumbnails"&gt;
          &lt;li ng-repeat="thumbnail in thumbnails  | filter:query" ng-switch on='$first' data-ng-click="toggleObject.item = $index" &gt;
              &lt;div data-ng-class="{'active' : toggleObject.item == $index}" ng-switch-when='true' ng-click="getHdImage(thumbnail.IMAGE_ID)"&gt;
                  &lt;img id="imageViewContainer" ng-src="{{thumbnail.PATH_SMALL}}"/&gt;
              &lt;/div&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>controller : </p>
  
  <pre><code>        imageView.getViewsByGroupId($stateParams.groupid)
                      .success(function(data) {
                          $scope.thumbnails = data;
                          $scope.toggleObject = {item: -1};
                          console.log($scope);
          });
  </code></pre>
  
  <p>So that i could use this active class for making the background color as red. but the default click on first element is not happening. though clicking manually works just fine.</p>
  
  <p>What i am doing wrong here.</p>