Angular Rails 上的模板

Angular Templates on Rails

我正在使用 angular-rails-templates gem。我的 /app/assets/javascripts 中有一个名为 templates 的文件夹,我已将其包含在 application.js:

//= require_tree ./templates

模板内部有一个 test.html 文件 <h1>hello world</h1>

由于某种原因,test.html 没有被发现,当我在控制台注销 $templateCache.info()(使用 app.run)时,我有:

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

这原来是链轮不兼容(参见 here

简短版本是:

  1. gem 'sprockets', '2.12.3' 添加到您的 Gemfile
  2. 运行 bundle update sprockets