Skip to content

Instantly share code, notes, and snippets.

@RubyRonin
Created November 23, 2015 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RubyRonin/0509776d646e85fce150 to your computer and use it in GitHub Desktop.
Save RubyRonin/0509776d646e85fce150 to your computer and use it in GitHub Desktop.
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