SlideShare a Scribd company logo
Syam kumar KK
Sr.Software Engineer |
www.ecreationsindia.com
syam@ecreationsindia.com
What Is Angular?
 A JavaScript MVW framework (development started in 2009 by a Google
employee Misko hevery and released in 2012)
 Good for single page applications
 AngularJS extends HTML with new attributes.
 AngularJS is a structural framework for dynamic web apps
 AngularJS was built with the CRUD application in mind
 Anjular Js uses Declarative Data-Binding ( Vs imperative
data binding )
 Anjular Js uses the concept two-way data binding
Why You Should Use
AngularJS
 MVC done right
 A declarative user interface
 Data models are POJO
 Behavior with directives
 Flexibility with filters
 Write less code
 Unit testing ready : Angular already has a mock HTTP provider
to inject fake server responses into controllers
MVC – Model View Controller
View
Renders the Model data
Send user actions to controller
UI
Model
Business logic
Notify view changes
Application functionality
Data in General
Controller
Define application behaviour
Maps user actions to model
Select view for response
Directives -special ng attributes
ng-app
 Determines which part of the page will use AngularJS
 If given a value it will load that application module
ng-controller
 Determines which Javascript Controller should be used
for that part of the page
ng-model
 Determines what model the value of an input field will
be bound to
 Used for two-way binding
ng-directives (basic use directives)
AngularJS extends HTML with ng-directives.
 The ng-bind directive binds application data
to the HTML view.
 The ng-show directive shows or hides the
given HTML element based on the
expression provided to the ngShow attribute.
 The ngClick directive allows you to specify
custom behavior when an element is clicked.
AngularJS starts automatically when the web page has loaded
Egg:
<div ng-app="">
<p>Name: <input type="text" ng-
model="name"></p>
<p ng-bind="name"></p>
</div>
Egg:
<div ng-app="" ng-init="firstName='John'">
<p>The name is <span ng-
bind="firstName"></span></p>
</div>
AngularJS Expressions
AngularJS expressions are much like JavaScript
expressions: They can contain literals, operators, and
variables.
Example {{ 5 + 5 }} or {{ firstName + " " + lastName }}
Egg:
<div ng-app="">
<p>My first expression: {{ 5 + 5 }}</p>
</div>
Egg:
<div ng-app="" ng-init="quantity=1;cost=5">
<p>Total in dollar: {{ quantity * cost }}</p>
</div>
AngularJS Objects
 <div ng-app="" ng-init="person={firstName:'John',lastName:'Doe'}">
 <p>The name is {{ person.lastName }}</p>
 </div>
AngularJS Arrays
 <div ng-app="" ng-init="points=[1,15,19,2,40]">
 <p>The points are {{ points[2] }}</p>
 </div>
AngularJS Controllers
 The ng-controller directive defines the application controller.
 A controller is a JavaScript Object, created by a standard
JavaScript object constructor.
<div ng-app="" ng-controller="personController">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
Full Name: {{firstName + " " + lastName}}
</div>
<script>
function personController($scope) {
$scope.firstName="John",
$scope.lastName="Doe"
}
</script>
<div ng-app="" ng-controller="namesController">
<ul>
<li ng-repeat="x in names">
{{ x.name + ', ' + x.country }}
</li>
</ul>
</div>
<script>
function namesController($scope) {
$scope.names = [
{name:'Jani',country:'Norway'},
{name:'Hege',country:'Sweden'},
{name:'Kai',country:'Denmark'}
];
}
</script>
AngularJS Filters
Egg:
<div ng-app="" ng-controller="personController">
<p>The name is {{ lastName | uppercase }}</p>
</div>
Egg:
<div ng-app="" ng-controller="costController">
<input type="number" ng-model="quantity">
<input type="number" ng-model="price">
<p>Total = {{ (quantity * price) | currency }}</p>
</div>
AnjularJs services
 AngularJS $http is a core service for reading data from web servers.
 $http.get(url) is the function to use for reading server data.
<div ng-app="" ng-controller="customersController">
<ul>
<li ng-repeat="x in names">
{{ x.Name + ', ' + x.Country }}
</li>
</ul>
</div>
<script>
function customersController($scope,$http) {
$http.get("JSON.php")
.success(function(response) {$scope.names = response;});
}
</script>
* Built-in services always start with $ (e.g. $http).
* Define their own services by registering the service's name and
service factory function, with an Angular module.
AnjularJs Scopes
 scope is an object that refers to the application model.
 Scope is the glue between application controller and the view.
angular.module('scopeExample', [])
.controller('MyController', ['$scope', function($scope) {
$scope.username = 'World';
$scope.sayHello = function() {
$scope.greeting = 'Hello ' + $scope.username + '!';
};
}]);
* $rootScope
Dependency Injection
Dependency Injection is software
design pattern that deals with how code
gets hold of its dependencies.
Advantages of AnjularJS on HTML
compiler
1) No need to read user
input and merging it with
data
2 ) No need to
clobbering user input by
overwriting it
3 ) Its not require
managing the whole
update process
4) innerHTML is not
using
Please, please, please !!!
A hammer is an excellent tool,
but it’s not used for everything !!!
Resources
 https://docs.angularjs.org/guide
 https://docs.angularjs.org/api
 http://www.sitepoint.com/10-reasons-use-angularjs/
 http://www.w3schools.com/angular/
Thank you for listening !

More Related Content

What's hot (20)

PPTX
AngularJS Directives
Eyal Vardi
 
PPTX
AngularJS $Provide Service
Eyal Vardi
 
PPTX
AngularJS with TypeScript and Windows Azure Mobile Services
Rainer Stropek
 
PDF
AngularJS Basic Training
Cornel Stefanache
 
PDF
GDayX - Advanced Angular.JS
Nicolas Embleton
 
PPTX
AngularJS in 60ish Minutes
Dan Wahlin
 
PPTX
AngularJS Animations
Eyal Vardi
 
PDF
Workshop 12: AngularJS Parte I
Visual Engineering
 
PDF
Building scalable applications with angular js
Andrew Alpert
 
PDF
Intro to Angular.JS Directives
Christian Lilley
 
PDF
Angular js routing options
Nir Kaufman
 
PDF
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
FalafelSoftware
 
PPTX
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
 
PDF
Workshop 14: AngularJS Parte III
Visual Engineering
 
PPTX
Modules and injector
Eyal Vardi
 
PDF
준비하세요 Angular js 2.0
Jeado Ko
 
DOCX
Filters in AngularJS
Brajesh Yadav
 
PDF
Solid angular
Nir Kaufman
 
PDF
Workshop 13: AngularJS Parte II
Visual Engineering
 
PDF
Integrating Angular js & three.js
Josh Staples
 
AngularJS Directives
Eyal Vardi
 
AngularJS $Provide Service
Eyal Vardi
 
AngularJS with TypeScript and Windows Azure Mobile Services
Rainer Stropek
 
AngularJS Basic Training
Cornel Stefanache
 
GDayX - Advanced Angular.JS
Nicolas Embleton
 
AngularJS in 60ish Minutes
Dan Wahlin
 
AngularJS Animations
Eyal Vardi
 
Workshop 12: AngularJS Parte I
Visual Engineering
 
Building scalable applications with angular js
Andrew Alpert
 
Intro to Angular.JS Directives
Christian Lilley
 
Angular js routing options
Nir Kaufman
 
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
FalafelSoftware
 
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
 
Workshop 14: AngularJS Parte III
Visual Engineering
 
Modules and injector
Eyal Vardi
 
준비하세요 Angular js 2.0
Jeado Ko
 
Filters in AngularJS
Brajesh Yadav
 
Solid angular
Nir Kaufman
 
Workshop 13: AngularJS Parte II
Visual Engineering
 
Integrating Angular js & three.js
Josh Staples
 

Similar to AngularJs (20)

PDF
Dive into AngularJS and directives
Tricode (part of Dept)
 
PPTX
Angular js slides
Amr Abd El Latief
 
PPTX
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
Learnimtactics
 
PPTX
Angular js
ParmarAnisha
 
PPTX
Angular js
Behind D Walls
 
PDF
Introduction to AngularJS By Bharat Makwana
Bharat Makwana
 
DOCX
Angular js
prasaddammalapati
 
PPTX
Angular js
Steve Fort
 
PPTX
Angular Javascript Tutorial with command
ssuser42b933
 
PDF
AngularJS By Vipin
Vipin Mundayad
 
PPTX
Angular Js Get Started - Complete Course
EPAM Systems
 
PPT
AngularJS Mobile Warsaw 20-10-2014
Dariusz Kalbarczyk
 
PPTX
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
PDF
Introduction of angular js
Tamer Solieman
 
PPTX
Angular js PPT
Imtiyaz Ahmad Khan
 
PPTX
The Basics Angular JS
OrisysIndia
 
PPTX
Angular Js Basics
أحمد عبد الوهاب
 
PPTX
Introduction to single page application with angular js
Mindfire Solutions
 
PPTX
Angular js
vu van quyet
 
Dive into AngularJS and directives
Tricode (part of Dept)
 
Angular js slides
Amr Abd El Latief
 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
Learnimtactics
 
Angular js
ParmarAnisha
 
Angular js
Behind D Walls
 
Introduction to AngularJS By Bharat Makwana
Bharat Makwana
 
Angular js
prasaddammalapati
 
Angular js
Steve Fort
 
Angular Javascript Tutorial with command
ssuser42b933
 
AngularJS By Vipin
Vipin Mundayad
 
Angular Js Get Started - Complete Course
EPAM Systems
 
AngularJS Mobile Warsaw 20-10-2014
Dariusz Kalbarczyk
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
Introduction of angular js
Tamer Solieman
 
Angular js PPT
Imtiyaz Ahmad Khan
 
The Basics Angular JS
OrisysIndia
 
Angular Js Basics
أحمد عبد الوهاب
 
Introduction to single page application with angular js
Mindfire Solutions
 
Angular js
vu van quyet
 
Ad

Recently uploaded (20)

PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
PPT on the Development of Education in the Victorian England
Beena E S
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
Mathematics 5 - Time Measurement: Time Zone
menchreo
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
Dimensions of Societal Planning in Commonism
StefanMz
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPT on the Development of Education in the Victorian England
Beena E S
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Mathematics 5 - Time Measurement: Time Zone
menchreo
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
Ad

AngularJs

  • 1. Syam kumar KK Sr.Software Engineer | www.ecreationsindia.com [email protected]
  • 2. What Is Angular?  A JavaScript MVW framework (development started in 2009 by a Google employee Misko hevery and released in 2012)  Good for single page applications  AngularJS extends HTML with new attributes.  AngularJS is a structural framework for dynamic web apps  AngularJS was built with the CRUD application in mind  Anjular Js uses Declarative Data-Binding ( Vs imperative data binding )  Anjular Js uses the concept two-way data binding
  • 3. Why You Should Use AngularJS  MVC done right  A declarative user interface  Data models are POJO  Behavior with directives  Flexibility with filters  Write less code  Unit testing ready : Angular already has a mock HTTP provider to inject fake server responses into controllers
  • 4. MVC – Model View Controller View Renders the Model data Send user actions to controller UI Model Business logic Notify view changes Application functionality Data in General Controller Define application behaviour Maps user actions to model Select view for response
  • 5. Directives -special ng attributes ng-app  Determines which part of the page will use AngularJS  If given a value it will load that application module ng-controller  Determines which Javascript Controller should be used for that part of the page ng-model  Determines what model the value of an input field will be bound to  Used for two-way binding
  • 6. ng-directives (basic use directives) AngularJS extends HTML with ng-directives.  The ng-bind directive binds application data to the HTML view.  The ng-show directive shows or hides the given HTML element based on the expression provided to the ngShow attribute.  The ngClick directive allows you to specify custom behavior when an element is clicked.
  • 7. AngularJS starts automatically when the web page has loaded Egg: <div ng-app=""> <p>Name: <input type="text" ng- model="name"></p> <p ng-bind="name"></p> </div> Egg: <div ng-app="" ng-init="firstName='John'"> <p>The name is <span ng- bind="firstName"></span></p> </div>
  • 8. AngularJS Expressions AngularJS expressions are much like JavaScript expressions: They can contain literals, operators, and variables. Example {{ 5 + 5 }} or {{ firstName + " " + lastName }} Egg: <div ng-app=""> <p>My first expression: {{ 5 + 5 }}</p> </div> Egg: <div ng-app="" ng-init="quantity=1;cost=5"> <p>Total in dollar: {{ quantity * cost }}</p> </div>
  • 9. AngularJS Objects  <div ng-app="" ng-init="person={firstName:'John',lastName:'Doe'}">  <p>The name is {{ person.lastName }}</p>  </div> AngularJS Arrays  <div ng-app="" ng-init="points=[1,15,19,2,40]">  <p>The points are {{ points[2] }}</p>  </div>
  • 10. AngularJS Controllers  The ng-controller directive defines the application controller.  A controller is a JavaScript Object, created by a standard JavaScript object constructor. <div ng-app="" ng-controller="personController"> First Name: <input type="text" ng-model="firstName"><br> Last Name: <input type="text" ng-model="lastName"><br> Full Name: {{firstName + " " + lastName}} </div> <script> function personController($scope) { $scope.firstName="John", $scope.lastName="Doe" } </script>
  • 11. <div ng-app="" ng-controller="namesController"> <ul> <li ng-repeat="x in names"> {{ x.name + ', ' + x.country }} </li> </ul> </div> <script> function namesController($scope) { $scope.names = [ {name:'Jani',country:'Norway'}, {name:'Hege',country:'Sweden'}, {name:'Kai',country:'Denmark'} ]; } </script>
  • 12. AngularJS Filters Egg: <div ng-app="" ng-controller="personController"> <p>The name is {{ lastName | uppercase }}</p> </div> Egg: <div ng-app="" ng-controller="costController"> <input type="number" ng-model="quantity"> <input type="number" ng-model="price"> <p>Total = {{ (quantity * price) | currency }}</p> </div>
  • 13. AnjularJs services  AngularJS $http is a core service for reading data from web servers.  $http.get(url) is the function to use for reading server data. <div ng-app="" ng-controller="customersController"> <ul> <li ng-repeat="x in names"> {{ x.Name + ', ' + x.Country }} </li> </ul> </div> <script> function customersController($scope,$http) { $http.get("JSON.php") .success(function(response) {$scope.names = response;}); } </script> * Built-in services always start with $ (e.g. $http). * Define their own services by registering the service's name and service factory function, with an Angular module.
  • 14. AnjularJs Scopes  scope is an object that refers to the application model.  Scope is the glue between application controller and the view. angular.module('scopeExample', []) .controller('MyController', ['$scope', function($scope) { $scope.username = 'World'; $scope.sayHello = function() { $scope.greeting = 'Hello ' + $scope.username + '!'; }; }]); * $rootScope
  • 15. Dependency Injection Dependency Injection is software design pattern that deals with how code gets hold of its dependencies.
  • 16. Advantages of AnjularJS on HTML compiler 1) No need to read user input and merging it with data 2 ) No need to clobbering user input by overwriting it 3 ) Its not require managing the whole update process 4) innerHTML is not using
  • 17. Please, please, please !!! A hammer is an excellent tool, but it’s not used for everything !!!
  • 18. Resources  https://docs.angularjs.org/guide  https://docs.angularjs.org/api  http://www.sitepoint.com/10-reasons-use-angularjs/  http://www.w3schools.com/angular/
  • 19. Thank you for listening !