Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Difference between AngularJS Expressions and JavaScript Expressions.

    • 0
    • 1
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 6.06k
    Comment on it

    Like JavaScript expressions, AngularJS expressions can contain literals, operators, and variables.

    Unlike JavaScript expressions, AngularJS expressions can be written inside HTML.

    AngularJS expressions do not support conditionals, loops, and exceptions, while JavaScript expressions do.

    AngularJS expressions support filters, while JavaScript expressions do not.

    Example:

    <!DOCTYPE html>
    <html>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/{version}/angular.min.js"></script>
    <body>    
    
     <div ng-app="" ng-init="quantity=1;cost=5">
     <p>My first expression: {{ 15 + 10 }}</p>
     <p>Total in dollar: {{ quantity * cost }}</p>
    

 1 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: