Created
November 23, 2015 03:09
-
-
Save RubyRonin/0509776d646e85fce150 to your computer and use it in GitHub Desktop.
how to update screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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