Add to your Gemfile:
gem 'angular-templates'
And then execute:
$ bundle
Add a config option to application.rb to set the module name the templates will be added
to
module YourApp
class Application < Rails::Application
config.angular_templates.module_name = 'app'
end
endIn your application.js add
//= require angular-templatesAnd then add your angular templates to the app/templates
directory. These templates will automatically be added to
Angular's $templateCache.
For example, the template app/templates/users/show.erb will be added
to $templateCache as users/show.
This has been tested with Rails 4.0+.
All of your helpers will be included and can be used in your
templates. Since the templates are rendered as part of the assets
pipeline they will not have access to controller instance
variables or methods (like cookies or session).
You can render partials inside your template. For example if you have
app/templates/users/_form.erb then in app/templates/users/new.erb
you can have:
...
<%= render 'users/form' %>
...Partials will not be added to $templateCache.
- Fix problems where file doesn't always update after a new file is created
- Add test code