I'm using Angularjs in parts of my Rails app, which works great. But I'm wondering how to use an Angular value inside a link_to.
Here is my pseudo code:
%table
%tr{"ng-repeat" => "book in books"}
%td
{{book.title}}
%td= link_to "Show", book_url({{book.id}})
This gives me an error:
syntax error, unexpected '}', expecting tASSOC
This could also have to do with HAML causing the error, but how can I send the ID in the link_to?
This worked for me:
<li ng-repeat="deal in deals">
<%= link_to 'show,'#','ng-href' => "#{deals_path()}/{{deal.id}}" %>
</li>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With