Addition, Subtraction, Multiplication and Division in AngularJs

AngularJSAngularJs is a library written in JavaScript. It is developed by Google employee, now Google officially supports it. There are many reasons to switch into AngularJS predominantly client side MVC, directive behavior, flexibility. In this tutorial I’m going to show how to perform addition, subtraction, multiplication and division instead of writing hello world program.

A first example: AngularJS

First of create a index.html file and open it with any of your favorite text editor, before you jump into AngularJS application you need to include script source that pointing to AngularJS script.

Just paste the following code into index.html file

You might noticed that above HTML code have some extended attributes. Those are AngularJS directives. ng-app directive is like delimiter in many programming languages. Eg: <?php ?> is a PHP delimiter where by PHP compiler parse the code only inside the delimiter, that same way AngularJS uses. Curly braces {{ expression | filter }}, Inside it you can place expression or filter. Once AngularJs compiler found that it will replace curly braces with evaluated value.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *