Any Angular directive works like Rails link_to(:method => "POST"?)

491 Views Asked by At

As title, I would like to use AngularJS to generate a link that works like a submit button of a form.

In Rails, I can achieve this by the link_to method: link_to "Cancel", bookings_path(@booking), :method => "DELETE". And then Rails will generate a hidden form for me to simulate form submitting when the link is clicked.

Is there any AngularJS directive can do this for me?

[EDIT]

What I want is a pure Angular way for this:

/ in some haml file
= link_to "Cancel", nil, :method => 'DELETE', :"ng-href" => "/bookings/{{id}}/"
1

There are 1 best solutions below

0
On

I am not sure, but may be this will help you,

%a{href: 'bookings/{{@booking}}'} 'Delete'