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


my data being displayed controller. "ng-repeat" works fine when displaying data, "ng-submit" not adding new data model using 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> 

function have execute it, addentry() should solve it.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -