Tag: angularjs templates

angular-rails-templates:找不到模板

我有一个rails应用程序,使用angularjs进行客户端开发。 我尝试加载位于`app / assets / javascripts / templates /’的模板: myApp.config([‘$routeProvider’, function($routeProvider) { $routeProvider. when(‘/’, { templateUrl: ‘/index.html’, controller: ‘MainController’ }). otherwise({ redirectTo: ‘/’ }); }]); 但我总是收到一个错误:“错误:[$ compile:tpload]无法加载模板:/index.html”。 我试图将“templates”文件夹移出javascripts – app / assets / templates并将其添加到我的资产管道加载中,方法是config.assets.paths << Rails.root.join("app","assets","templates")添加到config / application.rb: config.assets.paths << Rails.root.join("app","assets","templates") 在我使用模板的完整路径之前,我一直收到相同的错误消息: templateUrl: ‘/assets/index.html’, 为什么第一种方法不够用? angular-rails-templates gem不应该在app / assets / javascripts / templates中查找模板? 为什么我要使用javascript中的资源的完整路径?