SlideShare ist ein Scribd-Unternehmen logo
1 von 46
AngularJS
What is AngularJS?
AngularJS is a client-side MVC framework written in JavaScript. It
greatly helps us to write modern, single-page, Ajax-style web
applications.
Although, it is a general purpose framework, but it truly shines
when used with CRUD type applications.
Setting up AngularJS environment
Including AngularJS library
• Download from angularjs.org
• Or use one hosted on Google’s CDN network like so
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/ang
ular.min.js">
</script>
Simple Hello World application
Output
One Way Data Binding
Two Way Data Binding
Extending Hello World
Scopes
• A $scope object in AngularJS is here to expose the domain
model to a view.
• By assigning properties to scope instances, we can make new
values available to a template for rendering.
Getter Functions
<h1> Hello, {{ getName() }} </h1>
Controllers
• Controller is a JavaScript constructor function to initialize scope
objects.
• When a Controller is attached to the DOM via the ng-controller
directive, Angular will instantiate a new Controller object, using
the specified Controller's constructor function. A new child scope
will be available as an injectable parameter to the Controller's
constructor function as $scope.
Use controllers to :
• Set up the initial state of the $scope object.
• Add UI specific behavior to the $scope object.
Model
• AngularJS models are plain, old JavaScript objects.
• Any valid Javascript object or array can be passed to a model.
• To expose a model to AngularJS you simply assign it to a
$scope.
Hierarchy in scopes
• We need to have at least one instance of a scope to create a
new scope because ng-controller directive will create a new
scope using Scope.$new()
• AngularJS has a $rootScope i.e. a parent of all the scopes.
• $rootScope instance gets created when a new application is
bootstrap.
• Scopes are arranged in hierarchical structure which mimic the
DOM tree of the application.
Inheritance
Output
Fetching parent scope using $parent
Rule of thumb
Try to avoid using the $parent property as it strongly links
AngularJS expressions to the DOM structure created by your
tempaltes. An application might break as a result of simple
changes.
Alternative to $parent
Declarative template view – imperative
controller logic
• AngularJS promotes declarative approach to UI construction.
Templates are focused on describing a desired effect rather
than on ways of achieving it.
• It promotes declarative style of programming for templates
and imperative one for JavaScript code (controllers and
business logic)
Modules
Dependency Injection
• In addition to registering objects in a namespace, it is also
possible to declaratively describe dependencies among those
objects.
• It can perform following activities:
 Understand a need for collaborator expressed by objects.
 Wire up objects together into fully –functional application
Dependency Injection ($scope Obj)
Services
Controller example
var myApp = angular.module('myApp',[]);
myApp.controller('GreetingController', ['$scope',
function($scope) {
$scope.greeting = 'Hola!';
}]);
Registering Services
Angular services are substitutable objects that are wired
together using dependency injection (DI). You can use services to
organize and share code across your app.
Service example
Filters
A filter formats the value of an expression for display to the
user. They can be used in view templates, controllers or
services and it is easy to define your own filter.
Filter example
<div ng-controller="FilterController as ctrl">
<div>
All entries:
<span ng-repeat="entry in ctrl.array">{{entry.name}} </span>
</div>
<div>
Entries that contain an "a":
<span ng-repeat="entry in ctrl.filteredArray">{{entry.name}} </span>
</div>
</div>
angular.module('FilterInControllerModule', []).
controller('FilterController', ['filterFilter', function(filterFilter) {
this.array = [
{name: 'Tobias'},
{name: 'Jeff'},
{name: 'Brian'},
{name: 'Igor'},
{name: 'James'},
{name: 'Brad'}
];
this.filteredArray = filterFilter(this.array, 'a');
}]);
Communicating with Back-end Server
• AngularJS is well equiped with various back-ends using
XMLHttpRequest (XHR) and JSONP requests.
• It has a general purpose $http service for issuing XHR and
JSONP calls as well as a specialized $resource service to easily
target RESTful endpoints.
Making XHP requests with $http
Other XHR request methods
• GET : $http.get(url, config)
• POST : $http.post(url, data, config)
• PUT : $http.put(url, data, config)
• DELETE : $http.delete(url, config)
• HEAD : $http.head
• JSON : $http.jsonp(url, config)
Request/Response data conversion
• The $http.post and $http.put methods accept any JavaScript
object (or a String) value as their data parameter. If data is a
javaScript object it will be by default , converted to a JSON
string.
• The $http service will try to convert responses containg a
JSON string into JavaScript object.
HTTP Response parameters
• Data : The actual response data
• Status : The HTTP status
• Headers : HTTP response headers
• Config : The configurable object that was supplied with
request.
$resource service
• AngularJS provides a dedicated $resource services to make
interactions with REST endpoints.
• The $resource service is distributed in a separate file (angular-
resource.js), and resides in a dedicated module (ngResource).
• To use $resource we need to declare dependency on the
ngResource module from our application.
$resource example
Forms
Controls (input, select, textarea) are ways for a user to enter
data. A Form is a collection of controls for the purpose of
grouping related controls together.
Creating a form
Processing form
Form output
Using CSS classess
• ng-valid: the model is valid
• ng-invalid: the model is invalid
• ng-valid-[key]: for each valid key added by $setValidity
• ng-invalid-[key]: for each invalid key added by $setValidity
• ng-pristine: the control hasn't been interacted with yet
• ng-dirty: the control has been interacted with
• ng-touched: the control has been blurred
• ng-untouched: the control hasn't been blurred
• ng-pending: any $asyncValidators are unfulfilled
Customizing Form UI
<style type="text/css">
.css-form input.ng-invalid.ng-touched {
background-color: #FA787E;
}
.css-form input.ng-valid.ng-touched {
background-color: #78FA89;
}
</style>
Validating an email form field
<div ng-show="form.$submitted || form.uEmail.$touched">
<span ng-show="form.uEmail.$error.required">Tell us your
email.</span>
<span ng-show="form.uEmail.$error.email">This is not a valid
email.</span>
</div>
Why Should We Use AngularJS?
• MVC done right
• A declarative user interface
• Data models are POJO
• Behavior with directives
• Flexibility with filters
• Write less code
• DOM manipulations
• Service providers
• Unit testing ready
• Dynamic binding
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JSAkshay Mathur
 
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDBDynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDBApaichon Punopas
 
Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJSWei Ru
 
AngularJS in 60ish Minutes
AngularJS in 60ish MinutesAngularJS in 60ish Minutes
AngularJS in 60ish MinutesDan Wahlin
 
Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - IntroductionSagar Acharya
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs WorkshopRan Wahle
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS introdizabl
 
Angular JS Indtrodution
Angular JS IndtrodutionAngular JS Indtrodution
Angular JS Indtrodutionadesh21
 
Angular JS tutorial
Angular JS tutorialAngular JS tutorial
Angular JS tutorialcncwebworld
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginnersMunir Hoque
 
AngularJS Basics
AngularJS BasicsAngularJS Basics
AngularJS BasicsRavi Mone
 
Front end development with Angular JS
Front end development with Angular JSFront end development with Angular JS
Front end development with Angular JSBipin
 

Was ist angesagt? (20)

Angular js
Angular jsAngular js
Angular js
 
Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JS
 
Angular js
Angular jsAngular js
Angular js
 
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDBDynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
 
Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJS
 
AngularJS Basic Training
AngularJS Basic TrainingAngularJS Basic Training
AngularJS Basic Training
 
AngularJS in 60ish Minutes
AngularJS in 60ish MinutesAngularJS in 60ish Minutes
AngularJS in 60ish Minutes
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
 
Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS intro
 
Angular js PPT
Angular js PPTAngular js PPT
Angular js PPT
 
Angularjs Basics
Angularjs BasicsAngularjs Basics
Angularjs Basics
 
Angular js architecture (v1.4.8)
Angular js architecture (v1.4.8)Angular js architecture (v1.4.8)
Angular js architecture (v1.4.8)
 
Angular JS Indtrodution
Angular JS IndtrodutionAngular JS Indtrodution
Angular JS Indtrodution
 
Angular JS tutorial
Angular JS tutorialAngular JS tutorial
Angular JS tutorial
 
Angular js for Beginnners
Angular js for BeginnnersAngular js for Beginnners
Angular js for Beginnners
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
 
AngularJS Basics
AngularJS BasicsAngularJS Basics
AngularJS Basics
 
Front end development with Angular JS
Front end development with Angular JSFront end development with Angular JS
Front end development with Angular JS
 

Andere mochten auch

NES Global - Life Sciences Brochure 2016
NES Global - Life Sciences Brochure 2016NES Global - Life Sciences Brochure 2016
NES Global - Life Sciences Brochure 2016Joe Long
 
Детский консультативный Центр
Детский консультативный ЦентрДетский консультативный Центр
Детский консультативный Центрdamnedney
 
піраміда 1
піраміда 1піраміда 1
піраміда 12015aksyonov
 
Информационные технологии в деятельности психолога практика: повышение квалиф...
Информационные технологии в деятельности психолога практика: повышение квалиф...Информационные технологии в деятельности психолога практика: повышение квалиф...
Информационные технологии в деятельности психолога практика: повышение квалиф...Ilya Perminov
 
S2017 1. ansøgning Magasin dansk
S2017 1. ansøgning Magasin danskS2017 1. ansøgning Magasin dansk
S2017 1. ansøgning Magasin danskHenriette Pilegaard
 
Детский центр на Опарина 4
Детский центр на Опарина 4Детский центр на Опарина 4
Детский центр на Опарина 4damnedney
 
Evaluation question 7
Evaluation question 7Evaluation question 7
Evaluation question 7maxdellimayo
 
Роды и ведение беременности в научном Центре акушерства, гинекологии и перина...
Роды и ведение беременности в научном Центре акушерства, гинекологии и перина...Роды и ведение беременности в научном Центре акушерства, гинекологии и перина...
Роды и ведение беременности в научном Центре акушерства, гинекологии и перина...damnedney
 
Today we explored the sports that children play in Ghana
Today we explored the sports that children play in GhanaToday we explored the sports that children play in Ghana
Today we explored the sports that children play in Ghanaclarmadd
 

Andere mochten auch (17)

NES Global - Life Sciences Brochure 2016
NES Global - Life Sciences Brochure 2016NES Global - Life Sciences Brochure 2016
NES Global - Life Sciences Brochure 2016
 
ofr-566
ofr-566ofr-566
ofr-566
 
Osha300 a
Osha300 aOsha300 a
Osha300 a
 
Детский консультативный Центр
Детский консультативный ЦентрДетский консультативный Центр
Детский консультативный Центр
 
піраміда 1
піраміда 1піраміда 1
піраміда 1
 
Информационные технологии в деятельности психолога практика: повышение квалиф...
Информационные технологии в деятельности психолога практика: повышение квалиф...Информационные технологии в деятельности психолога практика: повышение квалиф...
Информационные технологии в деятельности психолога практика: повышение квалиф...
 
S2017 1. ansøgning Magasin dansk
S2017 1. ansøgning Magasin danskS2017 1. ansøgning Magasin dansk
S2017 1. ansøgning Magasin dansk
 
Print prezent anastassia filatova
Print prezent anastassia filatovaPrint prezent anastassia filatova
Print prezent anastassia filatova
 
KELEVRAGAMING
KELEVRAGAMINGKELEVRAGAMING
KELEVRAGAMING
 
El planner
El plannerEl planner
El planner
 
Детский центр на Опарина 4
Детский центр на Опарина 4Детский центр на Опарина 4
Детский центр на Опарина 4
 
Evaluation question 7
Evaluation question 7Evaluation question 7
Evaluation question 7
 
Роды и ведение беременности в научном Центре акушерства, гинекологии и перина...
Роды и ведение беременности в научном Центре акушерства, гинекологии и перина...Роды и ведение беременности в научном Центре акушерства, гинекологии и перина...
Роды и ведение беременности в научном Центре акушерства, гинекологии и перина...
 
Jihadismo in Libia_Full Version
Jihadismo in Libia_Full VersionJihadismo in Libia_Full Version
Jihadismo in Libia_Full Version
 
Today we explored the sports that children play in Ghana
Today we explored the sports that children play in GhanaToday we explored the sports that children play in Ghana
Today we explored the sports that children play in Ghana
 
J KHAN CV
J KHAN CVJ KHAN CV
J KHAN CV
 
Ppt
PptPpt
Ppt
 

Ähnlich wie Angular js

Angular workshop - Full Development Guide
Angular workshop - Full Development GuideAngular workshop - Full Development Guide
Angular workshop - Full Development GuideNitin Giri
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to AngularjsGaurav Agrawal
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Learning AngularJS  - Complete coverage of AngularJS features and conceptsLearning AngularJS  - Complete coverage of AngularJS features and concepts
Learning AngularJS - Complete coverage of AngularJS features and conceptsSuresh Patidar
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseEPAM Systems
 
AgularJS basics- angular directives and controllers
AgularJS basics- angular directives and controllersAgularJS basics- angular directives and controllers
AgularJS basics- angular directives and controllersjobinThomas54
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014Ran Wahle
 
Step by Step - AngularJS
Step by Step - AngularJSStep by Step - AngularJS
Step by Step - AngularJSInfragistics
 
Introduction to single page application with angular js
Introduction to single page application with angular jsIntroduction to single page application with angular js
Introduction to single page application with angular jsMindfire Solutions
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSDavid Parsons
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation Phan Tuan
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedStéphane Bégaudeau
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014Sarah Hudson
 

Ähnlich wie Angular js (20)

Angular
AngularAngular
Angular
 
Angular
AngularAngular
Angular
 
Angular workshop - Full Development Guide
Angular workshop - Full Development GuideAngular workshop - Full Development Guide
Angular workshop - Full Development Guide
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Learning AngularJS  - Complete coverage of AngularJS features and conceptsLearning AngularJS  - Complete coverage of AngularJS features and concepts
Learning AngularJS - Complete coverage of AngularJS features and concepts
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
 
AgularJS basics- angular directives and controllers
AgularJS basics- angular directives and controllersAgularJS basics- angular directives and controllers
AgularJS basics- angular directives and controllers
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
AngularJS Workshop
AngularJS WorkshopAngularJS Workshop
AngularJS Workshop
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJS
 
Step by Step - AngularJS
Step by Step - AngularJSStep by Step - AngularJS
Step by Step - AngularJS
 
AngularJS By Vipin
AngularJS By VipinAngularJS By Vipin
AngularJS By Vipin
 
Introduction to single page application with angular js
Introduction to single page application with angular jsIntroduction to single page application with angular js
Introduction to single page application with angular js
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
 
AngularJs Crash Course
AngularJs Crash CourseAngularJs Crash Course
AngularJs Crash Course
 
AngularJS in practice
AngularJS in practiceAngularJS in practice
AngularJS in practice
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014
 
Wt unit 5 client &amp; server side framework
Wt unit 5 client &amp; server side frameworkWt unit 5 client &amp; server side framework
Wt unit 5 client &amp; server side framework
 

Kürzlich hochgeladen

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 

Kürzlich hochgeladen (20)

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 

Angular js

  • 2. What is AngularJS? AngularJS is a client-side MVC framework written in JavaScript. It greatly helps us to write modern, single-page, Ajax-style web applications. Although, it is a general purpose framework, but it truly shines when used with CRUD type applications.
  • 3. Setting up AngularJS environment Including AngularJS library • Download from angularjs.org • Or use one hosted on Google’s CDN network like so <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/ang ular.min.js"> </script>
  • 4. Simple Hello World application
  • 6. One Way Data Binding
  • 7. Two Way Data Binding
  • 9. Scopes • A $scope object in AngularJS is here to expose the domain model to a view. • By assigning properties to scope instances, we can make new values available to a template for rendering.
  • 10. Getter Functions <h1> Hello, {{ getName() }} </h1>
  • 11. Controllers • Controller is a JavaScript constructor function to initialize scope objects. • When a Controller is attached to the DOM via the ng-controller directive, Angular will instantiate a new Controller object, using the specified Controller's constructor function. A new child scope will be available as an injectable parameter to the Controller's constructor function as $scope.
  • 12. Use controllers to : • Set up the initial state of the $scope object. • Add UI specific behavior to the $scope object.
  • 13. Model • AngularJS models are plain, old JavaScript objects. • Any valid Javascript object or array can be passed to a model. • To expose a model to AngularJS you simply assign it to a $scope.
  • 14. Hierarchy in scopes • We need to have at least one instance of a scope to create a new scope because ng-controller directive will create a new scope using Scope.$new() • AngularJS has a $rootScope i.e. a parent of all the scopes. • $rootScope instance gets created when a new application is bootstrap. • Scopes are arranged in hierarchical structure which mimic the DOM tree of the application.
  • 17. Fetching parent scope using $parent
  • 18. Rule of thumb Try to avoid using the $parent property as it strongly links AngularJS expressions to the DOM structure created by your tempaltes. An application might break as a result of simple changes.
  • 20. Declarative template view – imperative controller logic • AngularJS promotes declarative approach to UI construction. Templates are focused on describing a desired effect rather than on ways of achieving it. • It promotes declarative style of programming for templates and imperative one for JavaScript code (controllers and business logic)
  • 22. Dependency Injection • In addition to registering objects in a namespace, it is also possible to declaratively describe dependencies among those objects. • It can perform following activities:  Understand a need for collaborator expressed by objects.  Wire up objects together into fully –functional application
  • 25. Controller example var myApp = angular.module('myApp',[]); myApp.controller('GreetingController', ['$scope', function($scope) { $scope.greeting = 'Hola!'; }]);
  • 26. Registering Services Angular services are substitutable objects that are wired together using dependency injection (DI). You can use services to organize and share code across your app.
  • 28. Filters A filter formats the value of an expression for display to the user. They can be used in view templates, controllers or services and it is easy to define your own filter.
  • 29. Filter example <div ng-controller="FilterController as ctrl"> <div> All entries: <span ng-repeat="entry in ctrl.array">{{entry.name}} </span> </div> <div> Entries that contain an "a": <span ng-repeat="entry in ctrl.filteredArray">{{entry.name}} </span> </div> </div>
  • 30. angular.module('FilterInControllerModule', []). controller('FilterController', ['filterFilter', function(filterFilter) { this.array = [ {name: 'Tobias'}, {name: 'Jeff'}, {name: 'Brian'}, {name: 'Igor'}, {name: 'James'}, {name: 'Brad'} ]; this.filteredArray = filterFilter(this.array, 'a'); }]);
  • 31. Communicating with Back-end Server • AngularJS is well equiped with various back-ends using XMLHttpRequest (XHR) and JSONP requests. • It has a general purpose $http service for issuing XHR and JSONP calls as well as a specialized $resource service to easily target RESTful endpoints.
  • 32. Making XHP requests with $http
  • 33. Other XHR request methods • GET : $http.get(url, config) • POST : $http.post(url, data, config) • PUT : $http.put(url, data, config) • DELETE : $http.delete(url, config) • HEAD : $http.head • JSON : $http.jsonp(url, config)
  • 34. Request/Response data conversion • The $http.post and $http.put methods accept any JavaScript object (or a String) value as their data parameter. If data is a javaScript object it will be by default , converted to a JSON string. • The $http service will try to convert responses containg a JSON string into JavaScript object.
  • 35. HTTP Response parameters • Data : The actual response data • Status : The HTTP status • Headers : HTTP response headers • Config : The configurable object that was supplied with request.
  • 36. $resource service • AngularJS provides a dedicated $resource services to make interactions with REST endpoints. • The $resource service is distributed in a separate file (angular- resource.js), and resides in a dedicated module (ngResource). • To use $resource we need to declare dependency on the ngResource module from our application.
  • 38. Forms Controls (input, select, textarea) are ways for a user to enter data. A Form is a collection of controls for the purpose of grouping related controls together.
  • 42. Using CSS classess • ng-valid: the model is valid • ng-invalid: the model is invalid • ng-valid-[key]: for each valid key added by $setValidity • ng-invalid-[key]: for each invalid key added by $setValidity • ng-pristine: the control hasn't been interacted with yet • ng-dirty: the control has been interacted with • ng-touched: the control has been blurred • ng-untouched: the control hasn't been blurred • ng-pending: any $asyncValidators are unfulfilled
  • 43. Customizing Form UI <style type="text/css"> .css-form input.ng-invalid.ng-touched { background-color: #FA787E; } .css-form input.ng-valid.ng-touched { background-color: #78FA89; } </style>
  • 44. Validating an email form field <div ng-show="form.$submitted || form.uEmail.$touched"> <span ng-show="form.uEmail.$error.required">Tell us your email.</span> <span ng-show="form.uEmail.$error.email">This is not a valid email.</span> </div>
  • 45. Why Should We Use AngularJS? • MVC done right • A declarative user interface • Data models are POJO • Behavior with directives • Flexibility with filters • Write less code • DOM manipulations • Service providers • Unit testing ready • Dynamic binding