我在带有资产的 Ruby on Rails 3.2.8 项目中使用 AngularJS。
当我在我的开发机器上加载使用 AngularJS 的表单时,我没有问题。但是,当我在生产服务器上加载相同的表单时,我在 Javascript 控制台中收到此错误:
Error: Unknown provider: aProvider <- a
我已经将它追溯到我的咖啡脚本文件,我在其中设置了 AngularJS 以在表单中使用:
$ (event) ->
$("#timesheet_description").autocomplete({source: '/autocomplete/work_descs'})
# Create AngularJS module
app = angular.module 'timesheetApp', []
# Create a AngularJS controller
app.controller "TimesheetCtrl", ($scope) ->
$scope.costed_amount = 0
# Bind my module to the global variables so I can use it.
angular.bootstrap document, ["timesheetApp"]
如果我将所有这些注释掉,页面将加载而不会出现错误并且没有 AngularJS 功能。
问题是由于 Rails 资产编译和缩小造成的吗?有没有办法解决这个问题并仍然使用咖啡脚本和 Rails 资产?