我正在尝试让 Angular 加载模板:
var app = angular.module("myApp", ['templates'])
和我的html:
<div ng-app="myApp">
<div ng-include="'blah.html'"></div>
</div>
但我得到的只是404
Failed to load resource
因为,Rails 告诉我,No route matches [GET] "/blah.html"
. 我知道这是因为 Rails 中的资产管道。blah.html
在里面/app/assets/javascripts/templates/blah.html
,我正在使用angular-rails-templates
gem 来尝试解决问题。所以我application.js
有:
//= require angular-rails-templates
//= require_tree ./templates
但我没有任何运气。
生成的 html 表明angular-rails-templates
正在加载(它有一个脚本/assets/angular-rails-templates....js
)但 rails 找不到blah.html
版本:
rails 4.2.1
angular-rails-templates 0.1.4
angularjs 1.3.15