I am stuck in a doubt 
I have html :
Here, there are two types of data : post and person. The json for each post has array of persons. I wish to retrieve the rating Value, dataCategory and id (mydata.id/childData.id) from directive to controller : 
<div ng-repeat="mydata in data" class="ng-scope ng-binding">
   <p class="ng-binding">{{mydata.postdata}}</p> 
   <div star-rating rating-value="rating" data-cat="post" data-id="{{mydata.id}}" ></div>
   <div ng-repeat="childData in mydata.personRelatedData">
          {{childData.personName}}  
          <div star-rating rating-value="rating" data-cat="person" data-id="{{childData .id}}" >
   </div>
</div>
I have a Directive :
myDirectives.directive('starRating', function () {
    return {
      restrict: 'A',
      template: '<div> <ul style="margin : 0px">' +
                  '<li ng-repeat="i in getNumber(myNumber)" ng-click="toggle($index)" id=$index readonly="false">' +                   
                  '</li>' +
                '</ul></div>',
      scope: {
        ratingValue: '=',       
        dataCat: '=',  
        dataId: '=',  
        readonly: '@',
        onRatingSelected: '&'       
      },
      link: function (scope, elem, attrs) {       
      scope.myNumber = 5;       
      scope.getNumber = function(num) {
                   return new Array(num);   
        }       
        scope.toggle= function(val) {
               console.log("Val : "+val);
               console.log("dataCat : "+scope.dataCat);
               console.log("dataId : "+scope.dataId);
               ...
        }
What should I add in function toggle($index), to pass category name and its id too? Currently it shows :
Val : 1 
dataCat : undefined 
dataId : undefined 
I am new in angular js and can sense doing something wrong here.. like how to pass scope values to toggle function? Any help would be great..
Thanks