rida mukhtar
rida mukhtar

Reputation: 229

Angular delete button with Laravel controller

I have list of appointments in my database and I want to add a delete button for each appointment so when the delete button is licked the appointment gets deleted.

HTML Code

'              <td>\n' +
'               <a >Delete</a> </td>\n'+
'            </tr>\n' +

this is the delete button

Route.php

$api->delete('appointments/del', 'AppointmentsController@delete_appointment');

I have added this route in laravel.

AppointmentsController.php

public function delete_appointment(){
    console.log("delete");
}

now I am unable to call this function on the button click. I have tried ng-click and href ethod too, but no success.

Upvotes: 0

Views: 176

Answers (1)

Umang Patel
Umang Patel

Reputation: 133

you can not directly call laravel controller function from angular. you will have to make an http call from your angular application using the url (route) of your laravel controller function.

Upvotes: 0

Related Questions