Angular:'错误:areq Bad Argument'由于缩小?

时间:2014-10-31 11:48:52

标签: javascript ruby-on-rails angularjs

上下文

我正在运行Angular / Rails应用。现在,部署带有rails的部署管道是为了缩小脚本。我只是在生产中遇到错误,所以我认为这是造成它的缩小。

错误

https://docs.angularjs.org/error/ng/areq?p0=RepeatController&p1=not%20a%20function,%20got%20undefined

所以它告诉我在HTML中我引用了RepeatController,它没有找到它。

代码:

(为长度道歉,但这似乎是所有相关的位。)

HTML:

<html ng-app="myApp"> ...

<div ng-controller="RepeatController as repeatCtrl">
  ...
</div>

... </html>

角度应用:

(function(){
  var app = angular.module('myApp', ['Orders', 'TimePicker', 'Repeat', 'Payment']);

...

})();

完整控制器(在应用程序文件后加载的另一个文件中)

(function(){
  var app = angular.module('Repeat', []);

  app.controller('RepeatController', ['$scope', function ($scope) {

    $scope.repeatOptions = repeatOptions;
    $scope.setRepeatOption = function(option){
      $scope.orderCtrl.order.repeat = option;
    }

    $scope.orderCtrl.order.repeat = 'Weekly'

  }]);

  var repeatOptions = ['Monthly', 'Fortnightly', 'Weekly', 'Once']

})();

尝试解决方案

我搜索了SO的错误。除此之外,我完全被难倒了。同样的错误也发生在我所有的其他外部控制器上。

堆栈问题跟踪

(感谢您建议查看此内容)

这是heroku logs -t:

2014-10-31T13:32:17.723800+00:00 app[web.1]:   vendor/ruby-

2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-10-31T13:32:17.723807+00:00 app[web.1]: F, [2014-10-31T13:32:17.636444 #3] FATAL -- : 
2014-10-31T13:32:17.723870+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-10-31T13:32:17.723890+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-10-31T13:32:17.723930+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/rack/logger.rb:38:in `call_app'
2014-10-31T13:32:17.723958+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-10-31T13:32:17.631377+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/engine.rb:511:in `call'
2014-10-31T13:32:17.631379+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:97:in `call'
2014-10-31T13:32:17.631380+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-10-31T13:32:17.631381+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-10-31T13:32:17.631383+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-10-31T13:32:17.631384+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-10-31T13:32:17.631386+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-10-31T13:32:17.631387+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-10-31T13:32:17.632745+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:97:in `call'
2014-10-31T13:32:17.632766+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-10-31T13:32:17.632815+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/images/cards/mastercard.png"):
2014-10-31T13:32:17.632858+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-10-31T13:32:17.723739+00:00 app[web.1]: I, [2014-10-31T13:32:17.633582 #3]  INFO -- : Started GET "/images/cards/amex.png" for 92.237.49.190 at 2014-10-31 13:32:17 +0000
2014-10-31T13:32:17.723775+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/images/cards/amex.png"):
2014-10-31T13:32:17.723792+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:97:in `call'
2014-10-31T13:32:17.723814+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/images/cvc-icon.png"):
2014-10-31T13:32:17.723817+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-10-31T13:32:17.723819+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/rack/logger.rb:38:in `call_app'
2014-10-31T13:32:17.723820+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/rack/logger.rb:22:in `call'
2014-10-31T13:32:17.723821+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-10-31T13:32:17.723872+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-10-31T13:32:17.723883+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/rack/logger.rb:22:in `call'
2014-10-31T13:32:17.723898+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-10-31T13:32:17.723937+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-10-31T13:32:17.723938+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-10-31T13:32:17.723939+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-10-31T13:32:17.723941+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-10-31T13:32:17.723942+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/engine.rb:511:in `call'
2014-10-31T13:32:17.723961+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-10-31T13:32:17.723962+00:00 app[web.1]: 
2014-10-31T13:32:17.723963+00:00 app[web.1]: 
2014-10-31T13:32:17.632874+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-10-31T13:32:17.723751+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-10-31T13:32:17.723770+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-10-31T13:32:17.723781+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/rack/logger.rb:22:in `call'
2014-10-31T13:32:17.723790+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-10-31T13:32:17.723824+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-10-31T13:32:17.723847+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-10-31T13:32:17.723849+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-10-31T13:32:17.723850+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-10-31T13:32:17.723852+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/engine.rb:511:in `call'
2014-10-31T13:32:17.723853+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:97:in `call'
2014-10-31T13:32:17.723874+00:00 app[web.1]: 
2014-10-31T13:32:17.723876+00:00 app[web.1]: F, [2014-10-31T13:32:17.636484 #3] FATAL -- : 
2014-10-31T13:32:17.723877+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/images/cvc-icon.png
"):
2014-10-31T13:32:17.723891+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-10-31T13:32:17.723932+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/rack/logger.rb:22:in `call'
2014-10-31T13:32:17.723959+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-10-31T13:32:17.723754+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-10-31T13:32:17.723773+00:00 app[web.1]: 
2014-10-31T13:32:17.723784+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-10-31T13:32:17.723794+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-10-31T13:32:17.723803+00:00 app[web.1]: 
2014-10-31T13:32:17.723866+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-10-31T13:32:17.723880+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-10-31T13:32:17.723894+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:97:in `call'
2014-10-31T13:32:17.723935+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-10-31T13:32:17.723774+00:00 app[web.1]: F, [2014-10-31T13:32:17.634786 #3] FATAL -- : 
2014-10-31T13:32:17.723785+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-10-31T13:32:17.723796+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-10-31T13:32:17.723805+00:00 app[web.1]: I, [2014-10-31T13:32:17.635335 #3]  INFO -- : Started GET "/images/cvc-icon.png" for 92.237.49.190 at 2014-10-31 13:32:17 +0000
2014-10-31T13:32:17.723868+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-10-31T13:32:17.723881+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/rack/logger.rb:38:in `call_app'
2014-10-31T13:32:17.723895+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-10-31T13:32:17.723954+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-10-31T13:32:17.723955+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-10-31T13:32:17.723777+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-10-31T13:32:17.723795+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-10-31T13:32:17.723816+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-10-31T13:32:17.723823+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-10-31T13:32:17.723873+00:00 app[web.1]: 
2014-10-31T13:32:17.723884+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-10-31T13:32:17.723900+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-10-31T13:32:17.723952+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:97:in `call'
2014-10-31T13:32:17.723791+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/engine.rb:511:in `call'
2014-10-31T13:32:17.723802+00:00 app[web.1]: 
2014-10-31T13:32:17.723865+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-10-31T13:32:17.723879+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-10-31T13:32:17.723893+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/engine.rb:511:in `call'
2014-10-31T13:32:17.723933+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-10-31T13:32:17.631338+00:00 app[web.1]: => Run `rails server -h` for more startup options
2014-10-31T13:32:17.632751+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-10-31T13:32:17.632772+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-10-31T13:32:17.632818+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-10-31T13:32:17.723734+00:00 app[web.1]: I, [2014-10-31T13:32:17.633551 #3]  INFO -- : Started GET "/images/cards/amex.png" for 92.237.49.190 at 2014-10-31 13:32:17 +0000
2014-10-31T13:32:17.723799+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-10-31T13:32:17.723897+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-10-31T13:32:17.632765+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-10-31T13:32:17.723742+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/images/cards/amex.png"):
2014-10-31T13:32:17.723744+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-10-31T13:32:17.723746+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-10-31T13:32:17.723748+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/rack/logger.rb:38:in `call_app'
2014-10-31T13:32:17.723749+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/rack/logger.rb:22:in `call'
2014-10-31T13:32:17.723956+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'

这是我的chrome控制台:

Failed to load resource: the server responded with a status of 404 (Not Found) 

https://REDACTED.herokuapp.com/images/cards/visa.png
Error: [ng:areq] http://errors.angularjs.org/1.3.0/ng/areq?p0=RepeatController&p1=not%20a%20function%2C%20got%20undefined
    at Error (native)
    at https://REDACTED.herokuapp.com/assets/application-cdd806e9329bc42d9d2bb7068acf6cb1.js:4:19013
    at Z (https://REDACTED.herokuapp.com/assets/application-cdd806e9329bc42d9d2bb7068acf6cb1.js:4:25677)
    at et (https://REDACTED.herokuapp.com/assets/application-cdd806e9329bc42d9d2bb7068acf6cb1.js:4:25772)
    at https://REDACTED.herokuapp.com/assets/application-cdd806e9329bc42d9d2bb7068acf6cb1.js:5:20680
    at https://REDACTED.herokuapp.com/assets/application-cdd806e9329bc42d9d2bb7068acf6cb1.js:5:11518
    at o (https://REDACTED.herokuapp.com/assets/application-cdd806e9329bc42d9d2bb7068acf6cb1.js:4:19504)
    at w (https://REDACTED.herokuapp.com/assets/application-cdd806e9329bc42d9d2bb7068acf6cb1.js:5:11386)
    at s (https://REDACTED.herokuapp.com/assets/application-cdd806e9329bc42d9d2bb7068acf6cb1.js:5:8768)
    at s (https://REDACTED.herokuapp.com/assets/application-cdd806e9329bc42d9d2bb7068acf6cb1.js:5:8785) application-cdd806e9329bc42d9d2bb7068acf6cb1.js:6
Failed to load resource: the server responded with a status of 404 (Not Found) https://REDACTED.herokuapp.com/images/cards/mastercard.png
Failed to load resource: the server responded with a status of 404 (Not Found) https://REDACTED.herokuapp.com/images/cards/amex.png
Failed to load resource: the server responded with a status of 404 (Not Found) https://REDACTED.herokuapp.com/images/cvc-icon.png
Failed to load resource: the server responded with a status of 404 (Not Found) 

1 个答案:

答案 0 :(得分:0)

解决。堆栈跟踪指出最近添加的图像没有显示,而较旧的图像是。

要解决这个问题,我必须运行rake资产:在推送到heroku之前预编译。