title: Delete item from list of angular js and database
body: <p>hi i am new to angular js. In stage of learning. I had fetched data from database after the json encode. It worked sucessfully. I am using code igniter. Now i want to delete the list fetched from angular js and db too at a same time. But i cannot get any tutorials or i am unable to catch the concept. It would be great if someone could help me.</p>
  
  <p>Actually my logic is to catch the id of the post and pass this id to ci controller and deleting the post according to id by sending it to model. And fetching data from again after the delete from db so that new result would come. Is my logic correct or is there any other efficient way to perform the same task. I cannot pass the post id to ci controller and catch at ci controller.</p>
  
  <h2>app.js</h2>
  
  <pre><code> function PostsCtrlAjax($scope, $http) {
       $http({method: 'POST', 
              url: '&lt;?php echo base_url().'index.php/cms/get_feedback'; ?&gt;'     
       }).success(function(data) {
           $scope.posts = data; // response data 
       });
  
       $scope.deleteFeed = function (pId) { 
           //Defining $http service for deleting a list 
           alert(pId); //passing post id
           $http({ method: 'DELETE',
                   url: '&lt;?php echo base_url().'index.php/cms/del_feedback'; ?&gt;',
                   data : pId     //how can i send this pId to ci controller
           }).success(function (data) {
                 $scope.posts = data; // response data 
           });
       }
    }
  </code></pre>
  
  <h2>html</h2>
  
  <pre><code>&lt;ul class="list-group"&gt;
      &lt;li class="list-group-item feed" ng-repeat="post in posts"&gt;                       
          &lt;span style="font-weight: bold"&gt;{{post.name}}&lt;/span&gt;
          &lt;span style="font-size: 12px;"&gt;{{post.email}}&lt;/span&gt;
          &lt;span style="font-size: 12px;"&gt;{{post.short_date}}&lt;/span&gt;
          &lt;br&gt;
          &lt;span style="font-size: 12px;color: #aaa;"&gt;                            
              {{post.message_summary}}
          &lt;/span&gt;
          &lt;span class="glyphicon glyphicon-remove del_feedback" ng-click="deleteFeed(post.id)" style="position:absolute;top: 0%;right: 0%;color: #E13300;font-size: 10px;display: none;cursor: pointer;"&gt;&lt;/span&gt;
       &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>