Module: M1-R5: Information Technology Tools and Network Basics
Chapter: Ch1 Computer Intro
AngularJS expressions are used to bind data to HTML. They are written inside double curly braces {{ expression }} and are evaluated by AngularJS. Expressions can contain variables, operators, and functions.
Basic syntax:
{{ expression }}
Example:
{{ 5 + 3 }} <!-- Output: 8 -->
<!DOCTYPE html>
<html ng-app="">
<body>
<p>{{ 5 + 3 }}</p> <!-- Output: 8 -->
</body>
</html>
<!DOCTYPE html>
<html ng-app="">
<body>
<p>Hello, {{ name }}!</p>
<input type="text" ng-model="name">
</body>
</html>
Expressions can also use arithmetic, comparison, and logical operators:
<p>5 + 3 = {{ 5 + 3 }}</p>
<p>10 > 5? {{ 10 > 5 }} : {{ 10 < 5 }}</p>