title: Return to current state in AngularJS
body: <p>I have a facebook-like application written using codeigniter and angularjs. When I click the <code>like button</code> of a post, which the post resides in the bottom part of the page, I always get return back to the upper most part of the page. How can I make this when I click on that particular point, I will still stay in that area?</p>
  
  <p>here's the code</p>
  
  <pre><code>var newsfeed = angular.module('newsfeed', ['ngRoute']);
  
  
  newsfeed.controller('newsfeedController',function($scope,$http){
   var getPosts = function(){
      $http.get('/status_list/newsfeed_gen').success(function(data){
              $scope.posts = data;
              console.log(data);
      }); 
  }
  getPosts();
  
  $scope.like = function(id) {
      $http({
              method: "POST",
              url: '/status_list/like/'+ id,
              headers: { 'Content-Type' : 'application/x-www-form-urlencoded' },
              data: $.param(id)
              })
              .success(function(data){
                  console.log(data);
  
                  getPosts();
  
              })
              .error(function(data){
                  console.log(data);
              });
  }
  </code></pre>
  
  <p>});</p>
  
  <p>==== HTML ====</p>
  
  <pre><code>&lt;div ng-app="newsfeed" ng-controller="newsfeedController"&gt;
            &lt;div class="panel panel-default" ng-repeat="post in posts"&gt;
              &lt;div class="panel-heading"&gt;&lt;a href="#" class="pull-right"&gt;View all&lt;/a&gt; 
                  &lt;a href="&lt;?= base_url('{{post.username}}')?&gt;"&gt;
                      &lt;h4&gt;&lt;img src="&lt;?= base_url('{{post.profile_pic}}') ?&gt;"/&gt; {{post.fullname}}&lt;/h4&gt;
                  &lt;/a&gt;
                  &lt;h6&gt;{{post.date_posted}}&lt;/h6&gt;
              &lt;/div&gt;
              &lt;div class="panel-body"&gt;
                  &lt;div ng-show="post.photo != null"&gt;
                    &lt;img src="/public/uploads/{{post.photo}}"&gt;
                  &lt;/div&gt;
                      {{post.body}}
                  &lt;hr&gt;
                &lt;div class="input-group"&gt;
                    &lt;div class="input-group-btn"&gt;
                        &lt;button class="btn btn-default" data-ng-click="like(post.id)"&gt;{{post.like}} &lt;!-- like counter --&gt;&lt;i class="glyphicon glyphicon-thumbs-up"&gt; &lt;/i&gt; &lt;/button&gt;
                        &lt;button class="btn btn-default"&gt;{{post.comment}} &lt;!-- comment counter --&gt;&lt;i class="glyphicon glyphicon-comment"&gt;&lt;/i&gt;&lt;/button&gt;
                    &lt;/div&gt;
                    &lt;input type="text" class="form-control" placeholder="Add a comment.."&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>