I want to use ajax delete function:
angular_app.controller('contacts_controller', ['$scope', '$http', '$templateCache',
function ($scope, $http, $templateCache) {
$scope.delete(id) {
alert('del: '+id);
};
//....
}
]);
..and an assist function
function deleteContact(id) {
angular.element(document.getElementById("contacts_controller")).scope().delete(id);
}
And angular table to calling delete (I use laravel, so '{[{' and '}]}' instead of '{{' and '}}').
<tr ng-repeat="x in data">
<td>{[{ x.id }]}</td>
<td>{[{ x.name }]}</td>
<td>
<button onClick="deleteContact({[{ x.id }]})">Delete</a>
</td>
</tr>
How to put to work the delete contact. onClick="deleteContact(3)" works well. Thank you
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire