在 Rails 框架内使用 AngularJS。 "ng-repeat" 有效,但 "ng-submit" 无效

Using AngularJS inside Rails framework. "ng-repeat" is working, but "ng-submit" is not

My data is being displayed from the controller. "ng-repeat" works fine when displaying the data, but "ng-submit" is not adding new data to the model using the following code:

pages.js.coffee

  @PagesController = ($scope) ->
   $scope.entries = [
     {name:"Larry"}
     {name:"Curly"}
     {name:"Mo"}
     {name:"Ralph"}
    ]

    $scope.addEntry = ->
     $scope.entries.push($scope.newEntry)
     $scope.newEntry = {}

index.html.erb

  <div ng-controller="PagesController">


    <h1>Angular & Rails</h1>

    <form ng-submit="addEntry">
      <input type="text" ng-model="newEntry.name">
      <input type="submit" value="Add">
    </form>

    <ul>
      <li ng-repeat="entry in entries">
        {{entry.name}}
      </li>
    </ul>

   </div>

函数必须执行它,所以addEntry()应该解决它。