Angular: ng-repeat scope - 14410993

http://angularjs.org/

HTML

<body ng-controller="demoController">
    <ul>
      <li ng-repeat="item in items">
        {{ item }} <button ng-click="remove($index)">Remove</button>
      </li>
    </ul>
    
    <div>
      <input type="text" ng-model="input">
      <button type="submit" ng-click="add()">Add</button>
    </div>
  </body>

JavaScript

var app = angular.module('app', []);
app.controller('demoController', function($scope) {
    // initial items
    $scope.items = [
    	'item one',
    	'item two',
    	'item three'
    ];

    // add an item
    $scope.add = function() {
        $scope.items.push($scope.input);
    };
});