Make delicious recipes!


Here is an angular hello-world program consisting of two files: 1 html and 1 javascript

  1. Angular-Hello-World.html
        <title>AngularJS crash course - PrismoSkills</title>
        <!-- Link Twitter Bootstrap -->
        <link rel="stylesheet" href="">
        <!-- Link Angular.JS -->
        <script src=""></script>
        <!-- Write your Angular.JS code in this file (shown below) -->
        <script type="text/JavaScript" src="my-angular.js"></script>
        <div ng-app="store">
            I am {{4+6}}

  2. my-angular.js
    var moduleName = 'store';
    var moduleDependencies = [];
     * This line of code instructs angular to angularize any html element decorated with ng-app=moduleName
    var app = angular.module(moduleName, moduleDependencies);

  3. Result:
    I am {{4+6}}

What happened here?
In the JavaScript file, we created an angular module with the name 'store' (Don't worry about what a module is, for now)
Then the same name 'store' was used later in the html file as <div ng-app="store">
This binding tells AngularJS to pre-process the given html element before loading.
And due to this pre-processing, it was able to evaluate the AngularJS expression {{4+6}}
(Expressions in Angular are written under double curly braces, but more on that later.)

So the take away from the above code is to see how Angular can be bound to an html element.

Like us on Facebook to remain in touch
with the latest in technology and tutorials!

Got a thought to share or found a
bug in the code?
We'd love to hear from you:

Email: (Your email is not shared with anybody)

Facebook comments:

Site Owner: Sachin Goyal