Confirmation box for remove member
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
<h1> Jäsenlista </h1>
|
||||
|
||||
|
||||
<div >
|
||||
<table id="choose-address-table" class="ui-widget ui-widget-content">
|
||||
<thead>
|
||||
@@ -22,11 +20,10 @@
|
||||
<td>{{ x.jas }}</td>
|
||||
<td>{{ x.POR }}</td>
|
||||
<td>
|
||||
<a href="#/edit/{{x.id}}"<input type="button" value="Edit" class="btn btn-info"/></a>
|
||||
<input type="button" value="Remove" class="btn btn-danger" ng-click="delete_member(x.id)"/>
|
||||
<a href="#/edit/{{x.id}}"<input type="button" value="Edit" class="btn btn-info"/></a>
|
||||
<input type="button" value="Remove" class="btn btn-danger" confirmed-click="delete_member(x.id)" ng-confirm-click="Are you sure?"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
app.controller("getController", function($scope, $http, $window, $location){
|
||||
$scope.members = [];
|
||||
$http.get("/members/api/members").then(function(response){
|
||||
@@ -21,7 +20,23 @@ app.controller("getController", function($scope, $http, $window, $location){
|
||||
}
|
||||
);
|
||||
};
|
||||
});
|
||||
})
|
||||
.directive('ngConfirmClick',
|
||||
[
|
||||
function()
|
||||
{ return {
|
||||
link: function (scope, element, attr)
|
||||
{
|
||||
var msg = attr.ngConfirmClick || "Are you sure?";
|
||||
var clickAction = attr.confirmedClick;
|
||||
element.bind('click',function (event)
|
||||
{
|
||||
if ( window.confirm(msg) ) {
|
||||
scope.$eval(clickAction)
|
||||
}
|
||||
});
|
||||
}
|
||||
}}]);
|
||||
|
||||
app.controller("postController", function($scope, $http) {
|
||||
$scope.firstName = "";
|
||||
|
||||
Reference in New Issue
Block a user