AngularJS $$hashkey issue

https://groups.google.com/forum/#!topic/angular/PlRDyBHh_CE

by Jayesh Chandrapal

HTML

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
<div ng-controller="MainCtrl">
    <form role="form">
        <div class="form-group">
            <textarea ng-model="note" rows="4" class="form-control" placeholder="how was your day?"></textarea>
        </div>
        <div class="form-group">
            <button class="btn btn-success btn-sm" ng-click="saveNote()">{{btnText}}</button>
        </div>
    </form>
    
    
    <table class="table table-bordered table-striped">
        <tbody>
            <tr class="noterow" ng-repeat="item in diary">
                <td> <span class="pull-left label label-info">{{item.date}}</span>
&nbsp;{{item.note}} <span class="pull-right exbuttons">
                    <a href="#" title="Delete" ng-click="deleteNote(item.id)">
                      <small class="glyphicon glyphicon-trash"></small>
                    </a>
                  </span>

                </td>
            </tr>
        </tbody>
    </table>
    <div class="text-danger"><strong>Result:</strong> {{status}}</div>
</div>

CSS

body {
    margin: 10px;
    padding: 10px;
}

JavaScript

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

function MainCtrl($scope, $timeout) {
    $scope.btnText = 'Enter';
    $scope.note = '';
    $scope.diary = [];

    var note = {
        id: Math.floor((Math.random()*1000)+1),
        date: 'Feb 10',
        note: 'Wonderful day today'
    };
    $scope.diary.push(note);

    var note = {
        id: Math.floor((Math.random()*1000)+1),
        date: 'Feb 11',
        note: 'Killer food made today'
    };
    $scope.diary.push(note);

    var note = {
        id: Math.floor((Math.random()*1000)+1),
        date: 'Feb 18',
        note: 'Angular $$hashkey problem :('
    };
    $scope.diary.push(note);
    $scope.status = JSON.stringify($scope.diary);

    $scope.saveNote = function () {
        if ($scope.note != '') {
            $scope.btnText = 'Saving';

            $timeout(function () {
                var note = {
                    id: Math.floor((Math.random()*1000)+1),
                    date: 'Feb 19',
                    note: $scope.note
                };
                $scope.diary.push(note);
                $scope.note = '';
                $scope.btnText = 'Enter';
                $scope.status = JSON.stringify($scope.diary);
            }, 750);
        }
    };

    $scope.deleteNote = function (id) {
        console.log('Deleted id: ' + id);
        $scope.status = 'Deleted id: ' + id;
    };
};