SlideShare a Scribd company logo
ANGULAR JS
Anisha
INTRODUCTION
• Angular JS is a JavaScript.
• Added to an HTML page with a <script> tag.
• Extends HTML attributes with Directives.
• Binds data with Expressions.
• Used in Single Page Application (SPA) projects.

CORE FEATURES
WHY USE ANGULAR JS???
 Data-binding
 Dependency Injection
 MVC Framework
 Two-way data binding
 SPA(Single Page Application)
Example of Two Way Data Binding:
TWO WAY DATA BINDING
DIRECTIVE
Today’s HTML Component
ANGULARJS COMPONENTS/ DIRECTIVE
• ng-app − This directive initializes an AngularJS
application.
<div ng-app="">
• ng-model − This directive binds the values of AngularJS
application data to HTML input controls (input, select,
textarea) of our application .
ng-model="name"
• ng-bind − This directive binds the AngularJS
Application data to HTML tags.
ng-bind="name"
MODEL
The structure of your Application
NG-MODEL DIRECTIVE
 ng-model directive you can bind the value of an
input field to a variable created in AngularJS.
 Example:
<div ng-app="myApp" ng-controller="myCtrl">
Name: <input ng-model="name">
</div>
NG-BIND DIRECTIVE
 ng-bind directive, which will bind the innerHTML of
the element to the specified model property
 Example:
<p ng-bind="firstname"></p>
</div>
<div ng-app="myApp" ng-controller="myCtrl">
<p ng-bind="name"></p>
</div>
NG-REPEAT DIRECTIVE
 The ng-repeat directive repeats a set of HTML, a given
number of times.
 Syntax:
<element ng-repeat="expression"></element>
 Legal Expression examples:
x in records
(key, value) in myObj
Example:
<TR NG-REPEAT="X IN RECORDS">
<TD>{{X.NAME}}</TD>
<TD>{{X.COUNTRY}}</TD>
</TR>
<SCRIPT>
VAR APP = ANGULAR.MODULE("MYAPP", []);
APP.CONTROLLER("MYCTRL", FUNCTION($SCOPE) {
$SCOPE.RECORDS = [
{
"NAME" : "ALFREDS FUTTERKISTE",
"COUNTRY" : "GERMANY"
}, {
"NAME" : "BERGLUNDS SNABBKÖP",
"COUNTRY" : "SWEDEN"
} ]
});
</SCRIPT>
<TABLE NG-CONTROLLER="MYCTRL" BORDER="1">
<TR NG-REPEAT="(X, Y) IN MYOBJ">
<TD>{{X}}</TD>
<TD>{{Y}}</TD>
</TR>
</TABLE>
<SCRIPT>
VAR APP = ANGULAR.MODULE("MYAPP", []);
APP.CONTROLLER("MYCTRL", FUNCTION($SCOPE) {
$SCOPE.MYOBJ = {
"NAME" : "ALFREDS FUTTERKISTE",
"COUNTRY" : "GERMANY",
"CITY" : "BERLIN"
}
});
</SCRIPT>
EXPRESSIONS
Bind your Data anywhere in the page
ANGULARJS EXPRESSIONS
 AngularJS binds data to HTML
using Expressions.
 AngularJS expressions can be written inside
double braces: {{ expression }}.
 AngularJS expressions can also be written
inside a directive: ng-bind="expression".
My first expression: {{ 5 + 5 }}
ANGULARJS MODULES
 An AngularJS module defines an application.
 The module is a container for the application
controllers.
 A module is created by using the AngularJS
function angular.module
 Example:
<div ng-app="myApp">...</div>
<script>
var app = angular.module("myApp", []);
</script>
<div ng-app="myApp">...</div>
<script>
var app = angular.module("myApp", []);
</script>
CONTROLLERS
Data provider for our view
ANGULARJS CONTROLLERS
 AngularJS applications are controlled by controllers. They act as
containers.
 The ng-controller directive defines the application controller.
 Example:
<div ng-app="myApp" ng-controller="myCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
Full Name: {{firstName + " " + lastName}}
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe"; });
</script>
<div ng-app="myApp" ng-controller="myCtrl">
First Name: <input type="text" ng-
model="firstName"><br>
Last Name: <input type="text" ng-
model="lastName"><br>
<br>
Full Name: {{firstName + " " + lastName}}
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe"; });
</script>
CONTROLLERS IN EXTERNAL FILES
 In larger applications, it is common to store
controllers in external files.
 Example:
<div ng-app="myApp" ng-
controller="personCtrl">
First Name: <input type="text" ng-
model="firstName"><br>
Last Name: <input type="text" ng-
model="lastName"><br>
<br>
Full Name: {{fullName()}}
</div>
<script src="personController.js"></script>
<div ng-app="myApp" ng-controller="personCtrl">
First Name: <input type="text" ng-
model="firstName"><br>
Last Name: <input type="text" ng-
model="lastName"><br>
<br>
Full Name: {{fullName()}}
</div>
<script src="personController.js"></script>
PERSONCONTROLLER.JS
 app.controller('personCtrl', function($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe";
$scope.fullName = function() {
return $scope.firstName + " " +
$scope.lastName;
};
app.controller('personCtrl', function($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe";
$scope.fullName = function() {
return $scope.firstName + " " +
$scope.lastName;
};
ANGULARJS SCOPE
 The scope is the binding part between the HTML (view)
and the JavaScript (controller).
 Example:
<div ng-app="myApp" ng-
controller="myCtrl">
<h1>{{carname}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.carname = "Volvo";
});
</script>
<div ng-app="myApp" ng-controller="myCtrl">
<h1>{{carname}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.carname = "Volvo";
});
</script>
SERVICES
Utility component of our Application
ANGULARJS SERVICES
 $http Service
 The service makes a request to the server, and lets your
application handle the response.
 Example:
$http.get("welcome.htm").then(function (resp
onse) {
$scope.myWelcome = response.data;
});
});
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http)
{
$http.get("welcome.htm").then(function (response) {
$scope.myWelcome = response.data;
});
});
$TIMEOUT SERVICE
 $timeout Service
o The $timeout service is AngularJS' version of
the window.setTimeout function.
o Example:
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope,
$timeout) {
$scope.myHeader = "Hello World!";
$timeout(function () {
$scope.myHeader = "How are you today?";
}, 2000);
});
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope,
$timeout) {
$scope.myHeader = "Hello World!";
$timeout(function () {
$scope.myHeader = "How are you today?";
}, 2000);
});
FILTERS
Change the way your expressions are displayed
UPPERCASE FILTER
 Syntax:
{{student.fullName() | uppercase}}
LOWERCASE FILTER
 Syntax:
{{student.fullName() | lowercase}}
ORDERBY FILTER
 Syntax:
<li ng-repeat = "subject in student.subjects |
orderBy:'marks'">
DEMO LOGIN FORM
PROJECT STRUCTURE
SPA WITH CRUD OPERATION
Angular js
Angular js
THANK YOU

More Related Content

PPTX
Angular js
PPTX
Understanding angular js
PPTX
Angular Js Basics
PPTX
Angular js
PPTX
Front end development with Angular JS
PPTX
Why angular js Framework
PPTX
Introduction to Angular js 2.0
PPTX
Angular Js Get Started - Complete Course
Angular js
Understanding angular js
Angular Js Basics
Angular js
Front end development with Angular JS
Why angular js Framework
Introduction to Angular js 2.0
Angular Js Get Started - Complete Course

What's hot (20)

PPTX
Angular js PPT
PPTX
AngularJs presentation
PPTX
Angular js architecture (v1.4.8)
PPTX
Angular js 1.0-fundamentals
PDF
Angular from Scratch
PPTX
Getting Started with Angular JS
PPTX
Dive into Angular, part 1: Introduction
PPTX
Angular JS - Introduction
PPTX
Angular js for beginners
PDF
AngularJS Best Practices
PDF
Advanced Tips & Tricks for using Angular JS
PPTX
Angular js
PPTX
Introduction to Angularjs
PDF
AngularJS Basic Training
PPTX
AngularJS Best Practices
PDF
Angular JS tutorial
DOCX
Directives
PPTX
Angular JS
PPTX
Introduction to AngularJS
DOCX
Controller in AngularJS
Angular js PPT
AngularJs presentation
Angular js architecture (v1.4.8)
Angular js 1.0-fundamentals
Angular from Scratch
Getting Started with Angular JS
Dive into Angular, part 1: Introduction
Angular JS - Introduction
Angular js for beginners
AngularJS Best Practices
Advanced Tips & Tricks for using Angular JS
Angular js
Introduction to Angularjs
AngularJS Basic Training
AngularJS Best Practices
Angular JS tutorial
Directives
Angular JS
Introduction to AngularJS
Controller in AngularJS
Ad

Viewers also liked (15)

PPTX
Angular js
PDF
Design patterns through refactoring
PDF
Design Patterns in .Net
PDF
Creational Design Patterns
PDF
Angular JS blog tutorial
PPTX
Node js meetup
PPTX
Get satrted angular js
PPTX
Angular 2
PPTX
Introduction to Node js
PDF
Object-oriented design patterns in UML [Software Modeling] [Computer Science...
PPT
Design Patterns
PDF
Modern UI Development With Node.js
PPT
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
PPT
Design Patterns (Examples in .NET)
PDF
Design Patterns Illustrated
Angular js
Design patterns through refactoring
Design Patterns in .Net
Creational Design Patterns
Angular JS blog tutorial
Node js meetup
Get satrted angular js
Angular 2
Introduction to Node js
Object-oriented design patterns in UML [Software Modeling] [Computer Science...
Design Patterns
Modern UI Development With Node.js
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Design Patterns (Examples in .NET)
Design Patterns Illustrated
Ad

Similar to Angular js (20)

PDF
Wt unit 5 client &amp; server side framework
PPTX
Intoduction to Angularjs
PPTX
Angularjs
PDF
Workshop 12: AngularJS Parte I
PDF
Dive into AngularJS and directives
PPTX
AngularJs
PPTX
Kalp Corporate Angular Js Tutorials
PPTX
ANGULARJS introduction components services and directives
PDF
One Weekend With AngularJS
PPTX
Angular workshop - Full Development Guide
PPTX
ANGULAR JS TRAINING IN PUNE
DOCX
Angular js
PDF
Introduction to AngularJS By Bharat Makwana
PPTX
Basics of AngularJS
PPTX
AngularJS
PPTX
Angular Javascript Tutorial with command
PPTX
AngularJs Basic Concept
PPTX
Angular Presentation
PPTX
Angular js
Wt unit 5 client &amp; server side framework
Intoduction to Angularjs
Angularjs
Workshop 12: AngularJS Parte I
Dive into AngularJS and directives
AngularJs
Kalp Corporate Angular Js Tutorials
ANGULARJS introduction components services and directives
One Weekend With AngularJS
Angular workshop - Full Development Guide
ANGULAR JS TRAINING IN PUNE
Angular js
Introduction to AngularJS By Bharat Makwana
Basics of AngularJS
AngularJS
Angular Javascript Tutorial with command
AngularJs Basic Concept
Angular Presentation
Angular js

Recently uploaded (20)

PDF
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
PDF
The Future of Smart Factories Why Embedded Analytics Leads the Way
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
DOCX
The Five Best AI Cover Tools in 2025.docx
PPTX
introduction to dart --- Section one .pptx
PDF
Winning Business in a Slowing Economy, How CPQ helps Manufacturers Protect Ma...
PPT
FALLSEM2025-26_ISWE304L_TH_VL2025260102786_2025-07-10_Reference-Material-II.ppt
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
PPTX
Save Business Costs with CRM Software for Insurance Agents
PPTX
Why Use Open Source Reporting Tools for Business Intelligence.pptx
PPTX
Benefits of DCCM for Genesys Contact Center
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PPTX
Materi-Enum-and-Record-Data-Type (1).pptx
PPTX
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
PPTX
AZ900_SLA_Pricing_2025_LondonIT (1).pptx
PPTX
Materi_Pemrograman_Komputer-Looping.pptx
PDF
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
The Future of Smart Factories Why Embedded Analytics Leads the Way
The Role of Automation and AI in EHS Management for Data Centers.pdf
The Five Best AI Cover Tools in 2025.docx
introduction to dart --- Section one .pptx
Winning Business in a Slowing Economy, How CPQ helps Manufacturers Protect Ma...
FALLSEM2025-26_ISWE304L_TH_VL2025260102786_2025-07-10_Reference-Material-II.ppt
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Save Business Costs with CRM Software for Insurance Agents
Why Use Open Source Reporting Tools for Business Intelligence.pptx
Benefits of DCCM for Genesys Contact Center
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Materi-Enum-and-Record-Data-Type (1).pptx
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
Micromaid: A simple Mermaid-like chart generator for Pharo
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
AZ900_SLA_Pricing_2025_LondonIT (1).pptx
Materi_Pemrograman_Komputer-Looping.pptx
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days

Angular js

  • 2. INTRODUCTION • Angular JS is a JavaScript. • Added to an HTML page with a <script> tag. • Extends HTML attributes with Directives. • Binds data with Expressions. • Used in Single Page Application (SPA) projects. 
  • 4. WHY USE ANGULAR JS???  Data-binding  Dependency Injection  MVC Framework  Two-way data binding  SPA(Single Page Application)
  • 5. Example of Two Way Data Binding:
  • 6. TWO WAY DATA BINDING
  • 8. ANGULARJS COMPONENTS/ DIRECTIVE • ng-app − This directive initializes an AngularJS application. <div ng-app=""> • ng-model − This directive binds the values of AngularJS application data to HTML input controls (input, select, textarea) of our application . ng-model="name" • ng-bind − This directive binds the AngularJS Application data to HTML tags. ng-bind="name"
  • 9. MODEL The structure of your Application
  • 10. NG-MODEL DIRECTIVE  ng-model directive you can bind the value of an input field to a variable created in AngularJS.  Example: <div ng-app="myApp" ng-controller="myCtrl"> Name: <input ng-model="name"> </div>
  • 11. NG-BIND DIRECTIVE  ng-bind directive, which will bind the innerHTML of the element to the specified model property  Example: <p ng-bind="firstname"></p> </div> <div ng-app="myApp" ng-controller="myCtrl"> <p ng-bind="name"></p> </div>
  • 12. NG-REPEAT DIRECTIVE  The ng-repeat directive repeats a set of HTML, a given number of times.  Syntax: <element ng-repeat="expression"></element>  Legal Expression examples: x in records (key, value) in myObj Example:
  • 13. <TR NG-REPEAT="X IN RECORDS"> <TD>{{X.NAME}}</TD> <TD>{{X.COUNTRY}}</TD> </TR> <SCRIPT> VAR APP = ANGULAR.MODULE("MYAPP", []); APP.CONTROLLER("MYCTRL", FUNCTION($SCOPE) { $SCOPE.RECORDS = [ { "NAME" : "ALFREDS FUTTERKISTE", "COUNTRY" : "GERMANY" }, { "NAME" : "BERGLUNDS SNABBKÖP", "COUNTRY" : "SWEDEN" } ] }); </SCRIPT>
  • 14. <TABLE NG-CONTROLLER="MYCTRL" BORDER="1"> <TR NG-REPEAT="(X, Y) IN MYOBJ"> <TD>{{X}}</TD> <TD>{{Y}}</TD> </TR> </TABLE> <SCRIPT> VAR APP = ANGULAR.MODULE("MYAPP", []); APP.CONTROLLER("MYCTRL", FUNCTION($SCOPE) { $SCOPE.MYOBJ = { "NAME" : "ALFREDS FUTTERKISTE", "COUNTRY" : "GERMANY", "CITY" : "BERLIN" } }); </SCRIPT>
  • 15. EXPRESSIONS Bind your Data anywhere in the page
  • 16. ANGULARJS EXPRESSIONS  AngularJS binds data to HTML using Expressions.  AngularJS expressions can be written inside double braces: {{ expression }}.  AngularJS expressions can also be written inside a directive: ng-bind="expression". My first expression: {{ 5 + 5 }}
  • 17. ANGULARJS MODULES  An AngularJS module defines an application.  The module is a container for the application controllers.  A module is created by using the AngularJS function angular.module  Example: <div ng-app="myApp">...</div> <script> var app = angular.module("myApp", []); </script> <div ng-app="myApp">...</div> <script> var app = angular.module("myApp", []); </script>
  • 19. ANGULARJS CONTROLLERS  AngularJS applications are controlled by controllers. They act as containers.  The ng-controller directive defines the application controller.  Example: <div ng-app="myApp" ng-controller="myCtrl"> First Name: <input type="text" ng-model="firstName"><br> Last Name: <input type="text" ng-model="lastName"><br> <br> Full Name: {{firstName + " " + lastName}} </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.firstName = "John"; $scope.lastName = "Doe"; }); </script> <div ng-app="myApp" ng-controller="myCtrl"> First Name: <input type="text" ng- model="firstName"><br> Last Name: <input type="text" ng- model="lastName"><br> <br> Full Name: {{firstName + " " + lastName}} </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.firstName = "John"; $scope.lastName = "Doe"; }); </script>
  • 20. CONTROLLERS IN EXTERNAL FILES  In larger applications, it is common to store controllers in external files.  Example: <div ng-app="myApp" ng- controller="personCtrl"> First Name: <input type="text" ng- model="firstName"><br> Last Name: <input type="text" ng- model="lastName"><br> <br> Full Name: {{fullName()}} </div> <script src="personController.js"></script> <div ng-app="myApp" ng-controller="personCtrl"> First Name: <input type="text" ng- model="firstName"><br> Last Name: <input type="text" ng- model="lastName"><br> <br> Full Name: {{fullName()}} </div> <script src="personController.js"></script>
  • 21. PERSONCONTROLLER.JS  app.controller('personCtrl', function($scope) { $scope.firstName = "John"; $scope.lastName = "Doe"; $scope.fullName = function() { return $scope.firstName + " " + $scope.lastName; }; app.controller('personCtrl', function($scope) { $scope.firstName = "John"; $scope.lastName = "Doe"; $scope.fullName = function() { return $scope.firstName + " " + $scope.lastName; };
  • 22. ANGULARJS SCOPE  The scope is the binding part between the HTML (view) and the JavaScript (controller).  Example: <div ng-app="myApp" ng- controller="myCtrl"> <h1>{{carname}}</h1> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.carname = "Volvo"; }); </script> <div ng-app="myApp" ng-controller="myCtrl"> <h1>{{carname}}</h1> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.carname = "Volvo"; }); </script>
  • 23. SERVICES Utility component of our Application
  • 24. ANGULARJS SERVICES  $http Service  The service makes a request to the server, and lets your application handle the response.  Example: $http.get("welcome.htm").then(function (resp onse) { $scope.myWelcome = response.data; }); }); var app = angular.module('myApp', []); app.controller('myCtrl', function($scope, $http) { $http.get("welcome.htm").then(function (response) { $scope.myWelcome = response.data; }); });
  • 25. $TIMEOUT SERVICE  $timeout Service o The $timeout service is AngularJS' version of the window.setTimeout function. o Example: var app = angular.module('myApp', []); app.controller('myCtrl', function($scope, $timeout) { $scope.myHeader = "Hello World!"; $timeout(function () { $scope.myHeader = "How are you today?"; }, 2000); }); var app = angular.module('myApp', []); app.controller('myCtrl', function($scope, $timeout) { $scope.myHeader = "Hello World!"; $timeout(function () { $scope.myHeader = "How are you today?"; }, 2000); });
  • 26. FILTERS Change the way your expressions are displayed
  • 27. UPPERCASE FILTER  Syntax: {{student.fullName() | uppercase}} LOWERCASE FILTER  Syntax: {{student.fullName() | lowercase}} ORDERBY FILTER  Syntax: <li ng-repeat = "subject in student.subjects | orderBy:'marks'">
  • 30. SPA WITH CRUD OPERATION