javascript - angular-rails-templates Failed to load template -
i'm trying angular load template:
var app = angular.module("myapp", ['templates'])
and html:
<div ng-app="myapp"> <div ng-include="'blah.html'"></div> </div>
but 404
failed load resource
because, rails tells me, no route matches [get] "/blah.html"
. understand because of asset pipeline in rails. blah.html
in /app/assets/javascripts/templates/blah.html
, using angular-rails-templates
gem try solve problem. application.js
has:
//= require angular-rails-templates //= require_tree ./templates
but i'm not having luck.
the html generated suggests angular-rails-templates
loading (it has script /assets/angular-rails-templates....js
) rails failing find blah.html
versions:
rails 4.2.1
angular-rails-templates 0.1.4
angularjs 1.3.15
this turned out sprockets incompatibility (see here , here)
the short version is:
- add
gem 'sprockets', '2.12.3'
gemfile - run
bundle update sprockets
[update] i'm no expert on stuff seem number of people smarter suggesting using /public/templates
. may want bear in mind.
Comments
Post a Comment