Angular Templates on Rails

两盒软妹~` 提交于 2020-01-17 05:12:30

问题


I'm using the angular-rails-templates gem. I have a folder in my /app/assets/javascripts called templates and I have included it in application.js:

//= require_tree ./templates

Inside of templates there is a test.html file with <h1>hello world</h1>.

For some reason, test.html is not being found though, when I log out $templateCache.info() (using app.run) in the console I have:

Object {id: "templates", size: 0}


回答1:


This turned out to be a sprockets incompatibility (see here)

The short version is:

  1. Add gem 'sprockets', '2.12.3' to your Gemfile
  2. Run bundle update sprockets


来源:https://stackoverflow.com/questions/29751808/angular-templates-on-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!