Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
how to update screen
myApp.controller("ListTicketsCtrl", function($scope, $http) {
$http.get('https://example.com/tickets/')
.then(function(response){
$scope.tickets = response.data;
console.log(response.data);
});
$scope.removeItem = function(id){
$http.delete("https://example.com/tickets/" + id)
.success(function(){
console.log('sucess');
})
.error(function(error){
console.log(error);
});
};
});
<div class="page-header">
<h1>List Tickets</h1>
</div>
<div ng-controller="ListTicketsCtrl">
<ul>
<li ng-repeat="ticket in tickets"><b>Name:</b> {{ticket.name}} <b>Phone:</b> {{ticket.phone}} <b>Email:</b> {{ticket.email}} <b>Gym Rep:</b> {{ticket.gymrep}} ID: {{ticket._id}} | <a href ng-click="removeItem(ticket._id)">Delete</a> </li>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment