I have a Bootstrap modal which corresponds to a ng-repeat list. I would like to access the ng-repeat scope data from its parent, which contains the modal. I do this so that when the modal button is clicked on the list, the corresponding data from the JSON appears in the modal. 

I have found 2 ways of doing this, and I wonder which is the best alternative?

Method 1
View:

```
<li ng-init="myFunction(item,$parent)" ng-repeat="item in data.webapps_1.items>

```

Controller:

```
 $scope.myFunction = function(item,parent){
        parent.selected=item.counter-1;
    };

```

Method 2 View:

```
<li ng-init="$parent.selected=item.counter-1" ng-repeat="item in data.webapps_1.items>

```

With nothing in the controller.

I have read in the Angular ngInit docs that 

> 
> The only appropriate use of ngInit is for aliasing special properties
>  of ngRepeat, as seen in the demo below. Besides this case, you should
>  use controllers rather than ngInit to initialize values on a scope.
> 
> 
> 

But the list of special properties of ngRepeat does not include $parent.

So, which is the better practice? Including the expression `$parent.selected=item.counter-1`in the controller or in ngInit directive?

Thanks in advance