Angular: Empty Fiddle

http://angularjs.org/

by santhosh lanka

HTML

<script src="https://code.angularjs.org/1.4.0/angular.js"></script>
<div ng-controller="MyCtrl">
    <div ng-repeat="item in items | orderBy: 'id'" ng-click="delete(item)">
        <span>
            Hello, {{item.name}}!
        </span>
    </div>
</div>

JavaScript

var myApp = angular.module('myApp',[]);

myApp.controller('MyCtrl', function MyCtrl($scope) {
    $scope.items = [
        {
            name: 'item 1',
            id: '4'
        },
        {
            name: 'item 2',
            id: '3'
        },
        {
            name: 'item 3',
            id: '2'
        },
        {
            name: 'item 4',
            id: '1'
        }
    ];
    
    $scope.delete = function (item) {
        $scope.items.splice($scope.items.indexOf(item), 1);
    }
});