The ngInit directive allows you to evaluate an expression in the
current scope.
ngInit, such as for aliasing special properties of
ngRepeat, as seen in the demo below; and for injecting data via
server side scripting. Besides these few cases, you should use controllers
rather than ngInit to initialize values on a scope.
ngInit along with a filter, make
sure you have parentheses to ensure correct operator precedence:
<div ng-init="test1 = ($index | toString)"></div>
<ANY
  ng-init="expression">
...
</ANY>
      <ANY class="ng-init: expression;"> ... </ANY>
      | Param | Type | Details | 
|---|---|---|
| ngInit | expression | 
         Expression to eval.  | 
    
<script>
  angular.module('initExample', [])
    .controller('ExampleController', ['$scope', function($scope) {
      $scope.list = [['a', 'b'], ['c', 'd']];
    }]);
</script>
<div ng-controller="ExampleController">
  <div ng-repeat="innerList in list" ng-init="outerIndex = $index">
    <div ng-repeat="value in innerList" ng-init="innerIndex = $index">
       <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
    </div>
  </div>
</div>