# Developer Guide: Initializing Angular: Automatic Initialization

For Angular to manage the DOM for your application, it needs to compile some or all of an HTML page. Angular does this initialization automatically when you load the angular.js script into your page and insert an `ng-app` directive (attribute) into one of the page's elements. For example, we can tell Angular to initialize the entire document:

    <!doctype html>
    <html ng-app>
      <head>
        <script src="angular.js"></script>
      </head>
      <body>
        I can add: {{ 1+2 }}.
      </body>
    </html>

You can also tell Angular to manage only a portion of a page. You would want to do this if you are using some other framework to manage other parts of the page. You do this by placing the `ng-app` directive on one or more container elements in the document. For example:

    <div ng-app>
      I can add: {{ 1+2 }}
    </div>

You can also ask `ng-app` to load additional `modules` containing services, directives or filers that you'll use on the page.

###

###

    ...

    </pre</p>

    From a high-level, here's what Angular does during the initialization process:

    The browser loads the page, and then runs the Angular script. Angular then waits for the
    DOMContentLoaded (or 'Load') event to attempt to initialize.
    Angular looks for the ng-app directive. If found it compilies the DOM element containing ng-app and its children.
    Angular creates a global variable angular and binds all Angular APIs to this object's fields.

    Related Topics

    Angular HTML Compiler
    Initializing Angular
    Manual Initialization

    Related API

    Compiler API