SlideShare a Scribd company logo
Hiten Pratap Singh
http://github.com/hitenpratap
http://hprog99.wordpress.com
AngularJS from novice to
professional
Agenda
1. What is AngularJS?
2. Core features
3. It's working
4. How to start working with it?
5. Controller
6. AngularJS directives
7. Expression
8. Forms
9. Services
Agenda
10. Modules
9. Routing
10. Scope
11. Dependency Injection
12. Filters
13. Advantages and disadvantages
14. References
15. Q/A
16. Quiz
What's AngularJS?
AngularJS (commonly referred to as "Angular") is an
open-source web application framework maintained by
Google to address many of the challenges encountered
in developing single-page applications. It aims to simplify
both the development and the testing of such
applications by providing a framework for client-side
model–view–controller (MVC) – As per Wikipedia.
Core features
1.Two way data binding
2.Templates
3.Model view controller(MVC)
4.Dependency Injection
Two Way Data Binding
Templates
 In AngularJS, a template is just plain-old-HTML. The
HTML vocabulary is extended, to contain instructions
on how the model should be projected into the view.
 The HTML templates are parsed by the browser into
the DOM. The DOM then becomes the input to the
AngularJS compiler. AngularJS traverses the DOM
template for rendering instructions, which are called
directives. Collectively, the directives are responsible
for setting up the data-binding for your application
view.
Model View Controller(MVC or MVVC)
Dependency Injection
AngularJS Working
Hello World - AngularJS
AngularJS Controller
AngularJS Directives
 ng-app: Declares an element as root element
 ng-bind: Automatically changes the text of HTML element
 ng-model: Similar to ng-bind but allow two way binding
 ng-class: Allow class attribute to be dynaically loaded
 ng-controller: Specifies javascript controller class
 ng-repeat: Instantiate an element once per item from a collection
 ng-show & ng-hide: Conditionally show or hide an element
 ng-switch: Conditionally instantiate one template from a list
 ng-view: Rendering templates driven by specific controllers
 ng-if: Simple if-else attribute that we know from ever!
AngularJS Expression
Angular Form Properties $valid, $invalid, $pristine, $dirty
Angular also provides classes on the form and its inputs so that
you can style each state accordingly.
AngularJS Services
In Angular a service is a function or an object and is used to share data
and/or behavior across controllers, directives, filters, other services etc. A
service is treated as a singleton, that is there is only one instance of a
specific service available during the whole lifetime of the Angular
application. This is different from e.g. a controller of which many
instances can be created.
The easiest way is to use the Service recipe of an angular module.
var app = angular.module('app', []);
app.service('some-service', function(){…});
Other two methods/way to create service are:
1. The factory recipe
2.The provider recipe
AngularJS Module
AngularJS Routing
AngularJS Scope
AngularJS Dependency Injection
AngularJS has a built-in dependency injection subsystem that
helps the developer by making the application easier to develop,
understand, and test.
Dependency Injection (DI) allows you to ask for your
dependencies, rather than having to go look for them or make
them yourself. Think of it as a way of saying "Hey I need X', and
the DI is responsible for creating and providing it for you.
To gain access to core AngularJS services, it is simply a matter of
adding that service as a parameter; AngularJS will detect that you
need that service and provide an instance for you.
AngularJS Filters
Angular exposes a simple API for creating a filter. Just as you
would declare a controller with app.controller(‘myCtrl',
function(){});, you can create a new filter by appending
.filter(‘filterName', function(){}) to your Angular app.
AngularJS Advantages
 Super fast development
 Makes developing SPA easy
 Awesome performance
 Make apps scalable
 Data binding and DOM manipulation
AngularJS Disadvantages
 Good for I/O driven apps only(not games)
 Angular is big and complicated. With multiple ways to do
the same thing it is hard to tell which way is better for
particular task.
 The lifecycle of Angular application is complex, and to
master it you really need to read the code.
References
 AngularJS Docs(https://docs.angularjs.org/tutorial)
 AngularJS API Reference(https://docs.angularjs.org/api)
 AngularJS Code School(http://angular.codeschool.com/)
 ng-newsletter(http://www.ng-newsletter.com/books/)
Discussion Session
QUERIES ?
Hiten Pratap Singh
http://github.com/hitenpratap
http://hprog99.wordpress.com
Quiz Time
Anyone have any suggestons about what it should be? If no
then
We'll build an online contact manager just like
Google Contact.

More Related Content

What's hot (20)

Angular
AngularAngular
Angular
Mouad EL Fakir
 
Angular 14.pptx
Angular 14.pptxAngular 14.pptx
Angular 14.pptx
MohaNedGhawar
 
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
iFour Technolab Pvt. Ltd.
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
Rohit Gupta
 
Angular
AngularAngular
Angular
Lilia Sfaxi
 
Angular Introduction By Surekha Gadkari
Angular Introduction By Surekha GadkariAngular Introduction By Surekha Gadkari
Angular Introduction By Surekha Gadkari
Surekha Gadkari
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
Angular js
Angular jsAngular js
Angular js
Knoldus Inc.
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
Jadson Santos
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
WebStackAcademy
 
Angular 5 presentation for beginners
Angular 5 presentation for beginnersAngular 5 presentation for beginners
Angular 5 presentation for beginners
Imran Qasim
 
Angular 8
Angular 8 Angular 8
Angular 8
Sunil OS
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Malla Reddy University
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
Surbhi Panhalkar
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Angular overview
Angular overviewAngular overview
Angular overview
Thanvilahari
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
Christoffer Noring
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni
 
Angular Observables & RxJS Introduction
Angular Observables & RxJS IntroductionAngular Observables & RxJS Introduction
Angular Observables & RxJS Introduction
Rahat Khanna a.k.a mAppMechanic
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
Rohit Gupta
 
Angular Introduction By Surekha Gadkari
Angular Introduction By Surekha GadkariAngular Introduction By Surekha Gadkari
Angular Introduction By Surekha Gadkari
Surekha Gadkari
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
Jadson Santos
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
WebStackAcademy
 
Angular 5 presentation for beginners
Angular 5 presentation for beginnersAngular 5 presentation for beginners
Angular 5 presentation for beginners
Imran Qasim
 
Angular 8
Angular 8 Angular 8
Angular 8
Sunil OS
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Malla Reddy University
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni
 

Similar to AngularJS (20)

Angular js
Angular jsAngular js
Angular js
Baldeep Sohal
 
Angular js
Angular jsAngular js
Angular js
Ramakrishna kapa
 
Dive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionDive into Angular, part 1: Introduction
Dive into Angular, part 1: Introduction
Oleksii Prohonnyi
 
Angular Presentation
Angular PresentationAngular Presentation
Angular Presentation
Adam Moore
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
Everything You Need To Know About AngularJS
Everything You Need To Know About AngularJSEverything You Need To Know About AngularJS
Everything You Need To Know About AngularJS
Sina Mirhejazi
 
Angular workshop - Full Development Guide
Angular workshop - Full Development GuideAngular workshop - Full Development Guide
Angular workshop - Full Development Guide
Nitin Giri
 
Angular js
Angular jsAngular js
Angular js
Silver Touch Technologies Ltd
 
AngularJS: Overview & Key Features
AngularJS: Overview & Key FeaturesAngularJS: Overview & Key Features
AngularJS: Overview & Key Features
Mohamad Al Asmar
 
Angular js
Angular jsAngular js
Angular js
Behind D Walls
 
AngularJS Workshop
AngularJS WorkshopAngularJS Workshop
AngularJS Workshop
Gianluca Cacace
 
Introduction to AngularJs
Introduction to AngularJsIntroduction to AngularJs
Introduction to AngularJs
murtazahaveliwala
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
Boyan Mihaylov
 
AngularJS By Vipin
AngularJS By VipinAngularJS By Vipin
AngularJS By Vipin
Vipin Mundayad
 
Angular patterns
Angular patternsAngular patterns
Angular patterns
Premkumar M
 
Coffee@DBG - Exploring Angular JS
Coffee@DBG - Exploring Angular JSCoffee@DBG - Exploring Angular JS
Coffee@DBG - Exploring Angular JS
Deepu S Nath
 
AngularJS Basics
AngularJS BasicsAngularJS Basics
AngularJS Basics
Ravi Mone
 
Ajs ppt
Ajs pptAjs ppt
Ajs ppt
Avyaya Tarnaka
 
AngularJs
AngularJsAngularJs
AngularJs
syam kumar kk
 
Angular js 1.0-fundamentals
Angular js 1.0-fundamentalsAngular js 1.0-fundamentals
Angular js 1.0-fundamentals
Venkatesh Narayanan
 
Ad

More from NexThoughts Technologies (20)

Alexa skill
Alexa skillAlexa skill
Alexa skill
NexThoughts Technologies
 
GraalVM
GraalVMGraalVM
GraalVM
NexThoughts Technologies
 
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
NexThoughts Technologies
 
Apache commons
Apache commonsApache commons
Apache commons
NexThoughts Technologies
 
HazelCast
HazelCastHazelCast
HazelCast
NexThoughts Technologies
 
MySQL Pro
MySQL ProMySQL Pro
MySQL Pro
NexThoughts Technologies
 
Microservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & ReduxMicroservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & Redux
NexThoughts Technologies
 
Swagger
SwaggerSwagger
Swagger
NexThoughts Technologies
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
NexThoughts Technologies
 
Arango DB
Arango DBArango DB
Arango DB
NexThoughts Technologies
 
Jython
JythonJython
Jython
NexThoughts Technologies
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
NexThoughts Technologies
 
Smart Contract samples
Smart Contract samplesSmart Contract samples
Smart Contract samples
NexThoughts Technologies
 
My Doc of geth
My Doc of gethMy Doc of geth
My Doc of geth
NexThoughts Technologies
 
Geth important commands
Geth important commandsGeth important commands
Geth important commands
NexThoughts Technologies
 
Ethereum genesis
Ethereum genesisEthereum genesis
Ethereum genesis
NexThoughts Technologies
 
Ethereum
EthereumEthereum
Ethereum
NexThoughts Technologies
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
NexThoughts Technologies
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
NexThoughts Technologies
 
Google authentication
Google authenticationGoogle authentication
Google authentication
NexThoughts Technologies
 
Ad

Recently uploaded (20)

AI Emotional Actors: “When Machines Learn to Feel and Perform"
AI Emotional Actors:  “When Machines Learn to Feel and Perform"AI Emotional Actors:  “When Machines Learn to Feel and Perform"
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AkashKumar809858
 
Introducing the OSA 3200 SP and OSA 3250 ePRC
Introducing the OSA 3200 SP and OSA 3250 ePRCIntroducing the OSA 3200 SP and OSA 3250 ePRC
Introducing the OSA 3200 SP and OSA 3250 ePRC
Adtran
 
UiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPath Community Berlin: Studio Tips & Tricks and UiPath InsightsUiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPathCommunity
 
AI Trends - Mary Meeker
AI Trends - Mary MeekerAI Trends - Mary Meeker
AI Trends - Mary Meeker
Razin Mustafiz
 
Agentic AI - The New Era of Intelligence
Agentic AI - The New Era of IntelligenceAgentic AI - The New Era of Intelligence
Agentic AI - The New Era of Intelligence
Muzammil Shah
 
Co-Constructing Explanations for AI Systems using Provenance
Co-Constructing Explanations for AI Systems using ProvenanceCo-Constructing Explanations for AI Systems using Provenance
Co-Constructing Explanations for AI Systems using Provenance
Paul Groth
 
6th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 20256th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 2025
DanBrown980551
 
Supercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMsSupercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMs
Francesco Corti
 
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure ModesCognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Dr. Tathagat Varma
 
STKI Israel Market Study 2025 final v1 version
STKI Israel Market Study 2025 final v1 versionSTKI Israel Market Study 2025 final v1 version
STKI Israel Market Study 2025 final v1 version
Dr. Jimmy Schwarzkopf
 
Maxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing placeMaxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing place
usersalmanrazdelhi
 
Introducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and ARIntroducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and AR
Safe Software
 
Protecting Your Sensitive Data with Microsoft Purview - IRMS 2025
Protecting Your Sensitive Data with Microsoft Purview - IRMS 2025Protecting Your Sensitive Data with Microsoft Purview - IRMS 2025
Protecting Your Sensitive Data with Microsoft Purview - IRMS 2025
Nikki Chapple
 
LSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection FunctionLSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection Function
Takahiro Harada
 
Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...
pranavbodhak
 
TrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy ContractingTrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy Contracting
TrustArc
 
Grannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI ExperiencesGrannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI Experiences
Lauren Parr
 
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptxECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
Jasper Oosterveld
 
European Accessibility Act & Integrated Accessibility Testing
European Accessibility Act & Integrated Accessibility TestingEuropean Accessibility Act & Integrated Accessibility Testing
European Accessibility Act & Integrated Accessibility Testing
Julia Undeutsch
 
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 ADr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr. Jimmy Schwarzkopf
 
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AI Emotional Actors:  “When Machines Learn to Feel and Perform"AI Emotional Actors:  “When Machines Learn to Feel and Perform"
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AkashKumar809858
 
Introducing the OSA 3200 SP and OSA 3250 ePRC
Introducing the OSA 3200 SP and OSA 3250 ePRCIntroducing the OSA 3200 SP and OSA 3250 ePRC
Introducing the OSA 3200 SP and OSA 3250 ePRC
Adtran
 
UiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPath Community Berlin: Studio Tips & Tricks and UiPath InsightsUiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPathCommunity
 
AI Trends - Mary Meeker
AI Trends - Mary MeekerAI Trends - Mary Meeker
AI Trends - Mary Meeker
Razin Mustafiz
 
Agentic AI - The New Era of Intelligence
Agentic AI - The New Era of IntelligenceAgentic AI - The New Era of Intelligence
Agentic AI - The New Era of Intelligence
Muzammil Shah
 
Co-Constructing Explanations for AI Systems using Provenance
Co-Constructing Explanations for AI Systems using ProvenanceCo-Constructing Explanations for AI Systems using Provenance
Co-Constructing Explanations for AI Systems using Provenance
Paul Groth
 
6th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 20256th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 2025
DanBrown980551
 
Supercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMsSupercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMs
Francesco Corti
 
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure ModesCognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Dr. Tathagat Varma
 
STKI Israel Market Study 2025 final v1 version
STKI Israel Market Study 2025 final v1 versionSTKI Israel Market Study 2025 final v1 version
STKI Israel Market Study 2025 final v1 version
Dr. Jimmy Schwarzkopf
 
Maxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing placeMaxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing place
usersalmanrazdelhi
 
Introducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and ARIntroducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and AR
Safe Software
 
Protecting Your Sensitive Data with Microsoft Purview - IRMS 2025
Protecting Your Sensitive Data with Microsoft Purview - IRMS 2025Protecting Your Sensitive Data with Microsoft Purview - IRMS 2025
Protecting Your Sensitive Data with Microsoft Purview - IRMS 2025
Nikki Chapple
 
LSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection FunctionLSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection Function
Takahiro Harada
 
Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...Cyber security cyber security cyber security cyber security cyber security cy...
Cyber security cyber security cyber security cyber security cyber security cy...
pranavbodhak
 
TrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy ContractingTrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy Contracting
TrustArc
 
Grannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI ExperiencesGrannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI Experiences
Lauren Parr
 
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptxECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
Jasper Oosterveld
 
European Accessibility Act & Integrated Accessibility Testing
European Accessibility Act & Integrated Accessibility TestingEuropean Accessibility Act & Integrated Accessibility Testing
European Accessibility Act & Integrated Accessibility Testing
Julia Undeutsch
 
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 ADr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr. Jimmy Schwarzkopf
 

AngularJS

  • 2. AngularJS from novice to professional
  • 3. Agenda 1. What is AngularJS? 2. Core features 3. It's working 4. How to start working with it? 5. Controller 6. AngularJS directives 7. Expression 8. Forms 9. Services
  • 4. Agenda 10. Modules 9. Routing 10. Scope 11. Dependency Injection 12. Filters 13. Advantages and disadvantages 14. References 15. Q/A 16. Quiz
  • 5. What's AngularJS? AngularJS (commonly referred to as "Angular") is an open-source web application framework maintained by Google to address many of the challenges encountered in developing single-page applications. It aims to simplify both the development and the testing of such applications by providing a framework for client-side model–view–controller (MVC) – As per Wikipedia.
  • 6. Core features 1.Two way data binding 2.Templates 3.Model view controller(MVC) 4.Dependency Injection
  • 7. Two Way Data Binding
  • 8. Templates  In AngularJS, a template is just plain-old-HTML. The HTML vocabulary is extended, to contain instructions on how the model should be projected into the view.  The HTML templates are parsed by the browser into the DOM. The DOM then becomes the input to the AngularJS compiler. AngularJS traverses the DOM template for rendering instructions, which are called directives. Collectively, the directives are responsible for setting up the data-binding for your application view.
  • 12. Hello World - AngularJS
  • 14. AngularJS Directives  ng-app: Declares an element as root element  ng-bind: Automatically changes the text of HTML element  ng-model: Similar to ng-bind but allow two way binding  ng-class: Allow class attribute to be dynaically loaded  ng-controller: Specifies javascript controller class  ng-repeat: Instantiate an element once per item from a collection  ng-show & ng-hide: Conditionally show or hide an element  ng-switch: Conditionally instantiate one template from a list  ng-view: Rendering templates driven by specific controllers  ng-if: Simple if-else attribute that we know from ever!
  • 16. Angular Form Properties $valid, $invalid, $pristine, $dirty Angular also provides classes on the form and its inputs so that you can style each state accordingly.
  • 17. AngularJS Services In Angular a service is a function or an object and is used to share data and/or behavior across controllers, directives, filters, other services etc. A service is treated as a singleton, that is there is only one instance of a specific service available during the whole lifetime of the Angular application. This is different from e.g. a controller of which many instances can be created. The easiest way is to use the Service recipe of an angular module. var app = angular.module('app', []); app.service('some-service', function(){…}); Other two methods/way to create service are: 1. The factory recipe 2.The provider recipe
  • 21. AngularJS Dependency Injection AngularJS has a built-in dependency injection subsystem that helps the developer by making the application easier to develop, understand, and test. Dependency Injection (DI) allows you to ask for your dependencies, rather than having to go look for them or make them yourself. Think of it as a way of saying "Hey I need X', and the DI is responsible for creating and providing it for you. To gain access to core AngularJS services, it is simply a matter of adding that service as a parameter; AngularJS will detect that you need that service and provide an instance for you.
  • 22. AngularJS Filters Angular exposes a simple API for creating a filter. Just as you would declare a controller with app.controller(‘myCtrl', function(){});, you can create a new filter by appending .filter(‘filterName', function(){}) to your Angular app.
  • 23. AngularJS Advantages  Super fast development  Makes developing SPA easy  Awesome performance  Make apps scalable  Data binding and DOM manipulation
  • 24. AngularJS Disadvantages  Good for I/O driven apps only(not games)  Angular is big and complicated. With multiple ways to do the same thing it is hard to tell which way is better for particular task.  The lifecycle of Angular application is complex, and to master it you really need to read the code.
  • 25. References  AngularJS Docs(https://docs.angularjs.org/tutorial)  AngularJS API Reference(https://docs.angularjs.org/api)  AngularJS Code School(http://angular.codeschool.com/)  ng-newsletter(http://www.ng-newsletter.com/books/)
  • 26. Discussion Session QUERIES ? Hiten Pratap Singh http://github.com/hitenpratap http://hprog99.wordpress.com
  • 27. Quiz Time Anyone have any suggestons about what it should be? If no then We'll build an online contact manager just like Google Contact.