# `ngInit` (directive in module `ng` )

Improve this doc

## Description

The `ngInit` directive 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

- `ngInit – {expression} –`

  Expression to eval.

## Example

#### Source

#### Demo