AngularJS_unit II
AngularJS_unit II
ANGULAR JS
• AngularJS is a JavaScript framework.
• <script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.mi
n.js"></script>
AngularJS Extends HTML
• AngularJS will resolve the expression, and return the result exactly where the
expression is written.
• AngularJS expressions are much like JavaScript expressions: They can contain
literals, operators, and variables.
<div ng-app>
<p>My first expression: {{ 5 + 5 }}</p>
</div>
</body>
</html>
AngularJS Directives
• AngularJS directives are extended HTML attributes with the prefix ng-.
• Normally, you will not use ng-init. You will use a controller or module
instead.
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></
script>
<body>
<div ng-app="" ng-init="firstName='John'">
<p>The name is <span ng-bind="firstName"></span></p>
</div>
</body>
</html>
<span>
<!DOCTYPE html>
<html>
<body>
<h1>The span element</h1>
<p>My mother has <span
style="color:blue;font-weight:bold">blue</span> eyes and my father has
<span style="color:darkolivegreen;font-weight:bold">dark green</span>
eyes.</p>
</body>
</html>
AngularJS Expressions
• AngularJS expressions are written inside double braces:
{{ expression }}.
<div ng-app="">
<p>My first expression: {{ 5 + 5 }}</p>
</div>
</body>
</html>
AngularJS Applications