Code in html.haml in Rails using AngularJS
%table
%tbody{:"ng-init" => "my_model=#{@current_user_things.to_json}"}
%tr{:"ng-repeat" => "row in my_model"}
%td
%a{:href => "{{row.permalink}}"}
{{row.name}}
I am trying to replace what was originally a link_to in Rails that linked to row's page to it's equivalent using AngularJS. As I am providing AngularJS a template to repeat with, I now need to generate the link on the client side. Is there a way to do that easily?
I realise I can simply go %a{:href => "http://blah.com/rows/{{row.permalink}}"}
but I would prefer a more elegant solution as the host can change.
I guess I could fix it like this:
%a{:href => "#{url_for(:action => 'index')}/{{row.permalink}}"}