Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Rails Templates just not working

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.

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.

here is my code on github: https://github.com/collapsarzhang/demo-projects/tree/master/flapper-news

like image 465
Kevin Zhang Avatar asked Apr 17 '15 21:04

Kevin Zhang


2 Answers

The solution I found was here: http://ademartutor.azurewebsites.net/angular-rails-templates-gem-error-with-sprockets-3-0-o/

It is a sprockets incompatibility but 2.1.3 works so use this in your Gemfile:

gem 'sprockets', '2.12.3'

(and obviously a bundle update sprockets would be required)

like image 107
jcuenod Avatar answered Oct 24 '22 10:10

jcuenod


It is enough by doing

bundle update

as the library is looking for sprockets ~> 2

like image 44
QuarK Avatar answered Oct 24 '22 10:10

QuarK