Ruby on rails 带有角度控制器的Rails 4不是函数[ng:areq]错误

Ruby on rails 带有角度控制器的Rails 4不是函数[ng:areq]错误,ruby-on-rails,angularjs,Ruby On Rails,Angularjs,我在网站上准备了一个反馈系统。用户可以在一个框中提交一些反馈,并通过Angular JS提交。它工作正常,但当我一周前检查系统时,它不工作。提交文本时,页面被重新加载,而不是发送文本。当查看Chrome控制台时,它指出: Error: [ng:areq] Argument 'FeedbackController' is not a function, got undefined 我不知道这个错误是什么意思。我尝试使用Postman测试服务器端是否工作,但Postman没有InvalidAuth

我在网站上准备了一个反馈系统。用户可以在一个框中提交一些反馈,并通过Angular JS提交。它工作正常,但当我一周前检查系统时,它不工作。提交文本时,页面被重新加载,而不是发送文本。当查看Chrome控制台时,它指出:

Error: [ng:areq] Argument 'FeedbackController' is not a function, got undefined
我不知道这个错误是什么意思。我尝试使用Postman测试服务器端是否工作,但Postman没有InvalidAuthenticationToken的授权。目前我被卡住了,不知道我能做些什么来调试这个问题。任何想法都将不胜感激

Feedback.js.coffee:

@app = angular.module("FeedbackBox", ["ngResource"])
app.factory "Feedback", ["$resource", ($resource) ->
  # It should not be update?
  $resource("/feedbacks/:id", {id: "@id"}, 
    {
      update: {method: "PUT"} ,
    })
]

@FeedbackController = ["$scope", "Feedback", ($scope, Feedback) ->
  ## $scope.messages = Feedback.query()
  #console.log "Within the Controller declaration!"

  $scope.addFeedback = ->
    console.log "Running addFeedback()"
    $scope.newFeedback.feedback_path = document.URL
    # console.log $scope.newFeedback
    Feedback.save($scope.newFeedback)

    ## Showing "Thank you!" after submission */
    $("#messageBox textarea").hide()
    $("#messageBox input:submit").hide()
    $("#messageBox .thanks").show()

    ## Hiding box after 3 seconds */
    setTimeout (->
      $("#messageBox .mainArea").removeClass "open"
      $("#messageBox textarea").show()
      $("#messageBox input:submit").show()
      $("#messageBox .thanks").hide()
      return
    ), 3000

    $scope.newFeedback = {}
]
反馈\u控制器.rb

def create
  respond_with Feedback.create(feedback_params)
end
更新 这里是我注册控制器的
\u feedbackBox.html.erb

    <div id="messageBox" ng-app="FeedbackBox" ng-controller="FeedbackController">
        <div class="handle"><%= t("tab_text", scope: 'feedbacks.messageBox')%></div>
        <div class="mainArea">
            <form ng-submit="addFeedback()">
                <p><%= t("question_text", scope: 'feedbacks.messageBox')%></p>
                <% unless signed_in? %>
                  <input type="text" placeholder="<%= t("name_placeholder", scope: 'feedbacks.messageBox')%>" ng-model="newFeedback.sender_name">
                <% end %>
                <div class="thanks" style="display: none; height: 200px;width: 340px;text-align: center;padding-top: 91px;"><%= t("thankyou_text", scope: 'feedbacks.messageBox')%></div>
                <textarea placeholder="<%= t("feedback_placeholder", scope: 'feedbacks.messageBox')%>" ng-model="newFeedback.content"></textarea>
                <input type="submit" value="<%= t("submit_button", scope: 'feedbacks.messageBox')%>">
            </form>
        </div>
    </div>


结构非常简单。。。有什么想法吗?感谢@PSL的建议,问题出现了,因为angular js版本从1.2.x升级到了1.3.x。我必须通过添加以下行来声明控制器:

app.controller(“FeedbackController”,FeedbackController)


现在一切都很好!谢谢@PSL

您在哪里注册控制器?什么版本的angular?检查这个谢谢你的回复!角度版本1.3.36。我在
div
注册了控制器,并附上了
表格:我认为@PSL提到的应该是问题的根源。angularjs rails gem没有固定到某个版本,我不久前进行了
捆绑包更新。如何将其更改为非全局设置?谢谢您可以按照注册工厂“反馈”的方式注册控制器,或者您也可以覆盖设置,如我在前面的评论中链接的旧答案中所述。。。