Skip to content

Instantly share code, notes, and snippets.

@kirel
Created October 7, 2013 09:03
Show Gist options
  • Select an option

  • Save kirel/6864795 to your computer and use it in GitHub Desktop.

Select an option

Save kirel/6864795 to your computer and use it in GitHub Desktop.
Angular template cache helper
module AngularHelper
# Usage:
# In your server side rendered template
# = ng_template 'path/to/partial', 'path/to/other/partial'
# and then in i.e. angular directives
# template: 'path/to/partial'
def ng_template *partial_paths
safe_join(
partial_paths.map do |partial_path|
content_tag 'script', render(partial_path), id: partial_path, type: "text/ng-template"
end
)
end
end
@kirel

kirel commented Oct 7, 2013

Copy link
Copy Markdown
Author

TODO locals an partials übergeben können.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment