angular.module.ng.$compileProvider.directive.ng-init

Description

The ng-init attribute specifies initialization tasks to be executed before the template enters execution mode during bootstrap.

Usage

as attribute
<ANY ng-init="{expression}">
   ...
</ANY>
as class
<ANY class="ng-init: {expression};">
   ...
</ANY>

Parameters

Example

<div ng-init="greeting='Hello'; person='World'">
  {{greeting}} {{person}}!
</div>
 
   it('should check greeting', function() {
     expect(binding('greeting')).toBe('Hello');
     expect(binding('person')).toBe('World');
   });