Including the Angular.js Library Code in an HTML Page


You wish to use Angular.js on a web page.


In order to get your first Angular.js app up and running you need to include the Angular Javascript file via script tag and make use of the ng-app directive.

    <script src="">
  <body ng-app>
    <p>This is your first angular expression: {{ 1 + 2 }}</p>


Adding the ng-app directive tells Angular to kick in its magic. The expression 1 is evaluated by Angular and the result 3 is rendered. Note that removing ng-app will result in the browser rendering the expression as is instead of evaluating it. Play around with the expression! You can, for instance, concatenate Strings and invert or combine Boolean values.