3
守则html.haml AngularJS使用AngularJS的link_to Rails中对Rails的等效
%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}}
我试图取代什么最初是在Rails的link_to是链接到它的使用AngularJS是等于行的网页。由于我为AngularJS提供了一个可重复使用的模板,现在我需要在客户端生成链接。有没有办法轻松做到这一点?
我知道我可以简单地去%a{:href => "http://blah.com/rows/{{row.permalink}}"}
但我更喜欢更优雅的解决方案,因为主机可以改变。