AngularJS: Protoypical Inheritance

HTML

<script src="http://ci.angularjs.org/job/angular.js-angular-master/ws/build/angular.js"></script>
<div ng-controller="Parent">
  Data length: {{ tickets.count() }}<br>
<div ng-controller="Child">
   
</div>
</div>

JavaScript

var myApp = angular.module('myApp', []);
myApp.factory('tickets', function factory() {
  
    var tickets = [];
    
    function add(ticket){
        tickets.push(ticket);
                              }
    function count(){
        return tickets.length;
    }
    
    return {
        add: add,
        count: count
    };
    
});


function Parent($scope, tickets) {
    $scope.tickets = tickets;
}

function Child($scope, tickets) {
    
    tickets.add({id:1}); 
    tickets.add({id:2});
 
}