I got into the same problem and found a solution after examining angular-rails-templates , carefully reading their documentation and using the solution proposed by the cutter in angularjs with the client side haml .
angular -rails-templates needs to recreate a homeless version of the haml engine. Therefore, they extend classes registered with Tilt, instead of using engines that have been added to asset pipelines. Therefore, the new CustomHamlEngine that we create and register in the asset pipeline is never used by the angular -rails template. Instead, we need to register a sloped engine.
Create the angular_rails_templates.rb file in the config / initializers folder and paste this code into it.
# config/initializers/angular_rails_templates.rb module CustomHamlEngine class HamlTemplate < Tilt::HamlTemplate def evaluate(scope, locals, &block) scope.class_eval do include Rails.application.routes.url_helpers include Rails.application.routes.mounted_helpers include ActionView::Helpers end super end end end Tilt.register CustomHamlEngine::HamlTemplate, '.haml'
This will replace the regular .haml engine with the one we just created. angular -rails-templates will process your haml file and it will support rail assistants as well as path helpers.
Remember to restart the server after including the file.
source share