All i want is to delete a row of a table by clicking a button. I am diong something like this
.controller('removeInput' , function($scope, $http) {
$scope.remove = function(index){
var inputId = {'inputId': $scope.inputId};
$http.delete(baseUrl + '/input/' ,inputId, _auth)
.success(function (){
console.log('deleted');
}).error(function(err){
console.log(err);
});
};
});
and in html its something like this
<tbody ng-controller = "input">
<tr ng-repeat = "inputs in inputData">
<td ng-model = "inputId">{{inputs.inputId}}</td>
<td><img ng-src = "{{inputs.thumbnailUrl}}"/></td>
<td>{{inputs.filename}}</td>
<td></td>
<td>{{inputs.updatedAt.date}}</td>
<td ng-controller = "removeInput">
<a class = "btn btn-option" ng-click = "remove(index)">
<span class = "glyphicon glyphicon-remove"></span>
</a>
</td>
</tr>
</tbody>
and its not working. Please suggest where I am wrong?
_auth? It is undefined in code shown. Alsonot workingisn't a proper problem statement. What do you see when you inspect the actual request in browser dev tools network tab? Should find lots of clues thereremove(inputs.inputId)?