Module: AngularJsHelper

Defined in:
lib/generators/angularjs_crud/install/templates/angular_js_helper.rb

Instance Method Summary collapse

Instance Method Details

#angular_inline_template(relative_file_path, template_id = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/angularjs_crud/install/templates/angular_js_helper.rb', line 3

def angular_inline_template(relative_file_path, template_id=nil)
  root_dir = "../../public/assets/js/apps"

  external_template_path = "#{root_dir}/#{relative_file_path}"
  external_template = render template: external_template_path
  template_id = relative_file_path if template_id == nil

  inline_template = "    <script type=\"text/ng-template\" id=\"\#{template_id}\">\n      \#{external_template}\n    </script>\n  HTML\n\n  inline_template.html_safe\nend\n"