Angular Rails 模板无法正常工作 [英] Angular Rails Templates just not working
问题描述
我正在关注思想家的教程(https://thinkster.io/angular-rails/)关于使用 angular+rails.一切都很好,直到我尝试使用 angular-rails-templates 将模板放入 javascript 文件夹中.我是 Rails 的新手,所以我不知道这个 gem 是如何工作的.但我确实多次按照教程进行操作,但仍然无法正常工作.
I am following thinker's tutorials (https://thinkster.io/angular-rails/) on using angular+rails. everything is fine until I try to use angular-rails-templates to put templates in javascript folder. I am new to rails so I don't know how this gem works. but I did follow the tutorial multiple times and still not working.
总而言之,注入 angular 应用程序的模板"模块似乎没有将这些模板编译到 templateCache 中,或者 application.js 文件忽略了所有扩展名为 .html 的文件.
To sum up, it seems that the 'templates' module injected into angular app is not compiling those templates into templateCache, or the application.js file is ignoring all the files with .html extension.
这是我在github上的代码:https://github.com/collapsarzhang/demo-projects/tree/master/flapper-新闻
here is my code on github: https://github.com/collapsarzhang/demo-projects/tree/master/flapper-news
推荐答案
我找到的解决方案在这里:http://ademartutor.azurewebsites.net/angular-rails-templates-gem-error-with-sprockets-3-0-o/
The solution I found was here: http://ademartutor.azurewebsites.net/angular-rails-templates-gem-error-with-sprockets-3-0-o/
这是一个 sprockets
不兼容,但 2.1.3 可以工作,所以在你的 Gemfile 中使用它:
It is a sprockets
incompatibility but 2.1.3 works so use this in your Gemfile:
gem 'sprockets', '2.12.3'
(显然需要一个 bundle update sprockets
)
这篇关于Angular Rails 模板无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!