'use strict';

/**
 * @ngdoc directive
 * @name ng.directive:ngInit
 * @restrict AC
 *
 * @description
 * The `ngInit` directive specifies initialization tasks to be executed
 *  before the template enters execution mode during bootstrap.
 *
 * @element ANY
 * @param {expression} ngInit {@link guide/expression Expression} to eval.
 *
 * @example
   <doc:example>
     <doc:source>
    <div ng-init="greeting='Hello'; person='World'">
      {{greeting}} {{person}}!
    </div>
     </doc:source>
     <doc:scenario>
       it('should check greeting', function() {
         expect(binding('greeting')).toBe('Hello');
         expect(binding('person')).toBe('World');
       });
     </doc:scenario>
   </doc:example>
 */
var ngInitDirective = ngDirective({
  compile: function() {
    return {
      pre: function(scope, element, attrs) {
        scope.$eval(attrs.ngInit);
      }
    }
  }
});

@@ -126,312 +126,853 @@
 ive 
-specifies initialization tasks to be executed%0A *  before the template enters execution mode during bootstrap.%0A *%0A * @element ANY%0A * @param %7Bexpression%7D ngInit %7B@link guide/expression Expression%7D to eval.%0A *%0A * @example%0A   %3Cdoc:example%3E%0A     %3Cdoc:source%3E%0A    %3Cdiv ng-init=%22greeting='Hello'; person='World'
+allows you to evaluate an expression in the%0A * current scope.%0A *%0A * %3Cdiv class=%22alert alert-error%22%3E%0A * The only appropriate use of %60ngInit%60 for aliasing special properties of%0A * %7B@link api/ng.directive:ngRepeat %60ngRepeat%60%7D, as seen in the demo bellow. Besides this case, you%0A * should use %7B@link guide/dev_guide.mvc.understanding_controller controllers%7D rather than %60ngInit%60%0A * to initialize values on a scope.%0A * %3C/div%3E%0A *%0A * @element ANY%0A * @param %7Bexpression%7D ngInit %7B@link guide/expression Expression%7D to eval.%0A *%0A * @example%0A   %3Cdoc:example%3E%0A     %3Cdoc:source%3E%0A   %3Cscript%3E%0A     function Ctrl($scope) %7B%0A       $scope.list = %5B%5B'a', 'b'%5D, %5B'c', 'd'%5D%5D;%0A     %7D%0A   %3C/script%3E%0A   %3Cdiv ng-controller=%22Ctrl%22%3E%0A     %3Cdiv ng-repeat=%22innerList in list%22 ng-init=%22outerIndex = $index%22%3E%0A       %3Cdiv ng-repeat=%22value in innerList%22 ng-init=%22innerIndex = $index
 %22%3E%0A 
@@ -980,34 +980,126 @@
     
+ 
-%7B%7Bgreeting%7D%7D %7B%7Bperson%7D%7D!%0A 
+   %3Cspan class=%22example-init%22%3Elist%5B %7B%7BouterIndex%7D%7D %5D%5B %7B%7BinnerIndex%7D%7D %5D = %7B%7Bvalue%7D%7D;%3C/span%3E%0A       %3C/div%3E%0A     %3C/div%3E%0A
    %3C
@@ -1165,22 +1165,29 @@
 uld 
-check greeting
+alias index positions
 ', f
@@ -1218,90 +1218,201 @@
 ect(
-binding('greeting')).toBe('Hello');%0A         expect(binding('person')).toBe('World
+element('.example-init').text())%0A           .toBe('list%5B 0 %5D%5B 0 %5D = a;' +%0A                 'list%5B 0 %5D%5B 1 %5D = b;' +%0A                 'list%5B 1 %5D%5B 0 %5D = c;' +%0A                 'list%5B 1 %5D%5B 1 %5D = d;
 ');%0A

add note on best practices