Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • AngularJs Expressions

    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 733
    Comment on it

    Hii,

    This blog is in continuation with my previous blog on directives in angularJs, in this blog,  I will discuss expressions in angularJs.

    • In angularJs  "Expression"  are used to bind data to HTML.
    • Expression were written inside two curly braces,and contain operators, variables, and literals.

    Syntax:{{ expression }}

     

    • As we know angularJs is a framework of javascript,many similarities are there like angularJs expressions are also very similar to javascript expressions.
    • Basically, angularJs is an efficient and easy way or method to use JavaScript functionalities, such as operators, variables, conditions etc to HTML.

    Example:

    We can use angularJs expressions when we want to assign any string value dynamically using an Angular directive .
    In this example, a string value is added.

    <div ng-app ng-init="name='Pinky'">
    My name is {{ name }}
    </div>

    Output

    My name is Pinky

    Example: 

    We can use angularJs expressions when we want to assign any number dynamically using an Angular directive.
    In this example a numeric value is added,Numeric values can also be a decimal values.

    <div ng-app>
    I have total Rs{{3000}} in my pocket.
    </div>

    Output

    I have total Rs3000 in my pocket.


    Note:Must inclue this link in your document when you are using angularjs
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: