SlideShare una empresa de Scribd logo
1 de 10
AngularJS
JAVASCRIPT WEB APPLICATION FRAMEWORK
Terminology
MVC architecture
• Model – data
• View – template
• Controller – code (JavaScript) that links views to models
Scopes
• Scope is an object that refers to the application model. It is an execution context for expressions. Scopes
are arranged in a hierarchical structure which mimics the DOM structure of the application. Scopes can
watch expressions and propagate events.
https://docs.angularjs.org/guide/scope
jQuery vs. AngularJS
•In jQuery you design a page and then make it dynamic, changing it with DOM manipulations.
•In AngularJS you design the architecture first, then your application, then your view (html
template). You don’t alter the DOM (usually).
•Think in terms of architecture – single page applications are applications, not webpages. You
must think like a server-side developer as well as a front-end developer.
•The view is the official record. By looking at it you can tell what directives are being applied.
Much cleaner and concise than jQuery.
•Data binding – most awesome feature of AngularJS. AngularJS updates the view so you don’t
have to code DOM manipulations.
•MVC architecture allows for a model completely separate from the view. In jQuery the DOM is
the model.
jQuery vs. AngularJS
•Separation of concerns – your view shows what is supposed to happen, your model represents
your data, there is a service layer to perform reusable tasks and you do DOM manipulations and
augment the view with directives. All of this is glued together with controllers.
•Dependency Injection – you can declare components and then from other component ask for an
instance of it without worrying about loading order, file locations, etc.
•Test Driven Development is possible with AngularJS; iterative only with jQuery.
Source: stackoverflow.com (link provided on last slide).
https://docs.angularjs.org/guide/directive
Angular Directives
ng-repeat
◦ Allows us to loop through an array
◦ https://docs.angularjs.org/api/ng/directive/ngRepeat
ng-src
◦ Prevents images from loading until the Angular library loads
◦ https://docs.angularjs.org/api/ng/directive/ngSrc
$scope vs. this
http://stackoverflow.com/questions/11605917/this-vs-scope-in-angularjs-controllers
this
•When the controller constructor function is called, this is the controller
•When a function defined on a $scope object is called, this is the “scope in effect” when the
function was called. This may or may not be the $scope the function was defined on. Inside
the function, this and $scope may not be the same.
$scope
•Every controller has an associated $scope object
•A controller function (aka constructor) is responsible for setting model properties and
functions/behavior on its associated $scope.
•Only methods defined on this $scope are accessible from the HTML/view – ng-click,
filters, etc.
Angular Filters
https://docs.angularjs.org/api/ng/filter/filter
Selects a subset of items from array and returns it as a new array
HTML template binding
{{ filter_expression | filter : expression : comparator}}
JavaScript
$filter(‘filter’)(array, expression, comparator)
Expression = string, object, or function (custom filters)
Comparator = function (actual, expected), true – shorthand for function(actual,
expected){return angular.equals(expected, actual)} , false/undefined (case
insensitive match shorthand)
ngRoute
https://docs.angularjs.org/api/ngRoute
Via routing we can access another Angular feature – deep linking
Use the service $routeProvider()
https://docs.angularjs.org/api/ngRoute/provider/$routeProvider
Remember, AngularJS is used to create one page apps. With ngRoute we can simulate multiple pages.
Animations
https://docs.angularjs.org/guide/animations
Assist with CSS animations
https://docs.angularjs.org/api/ng/directive/ngShow
Shows or hides the HTML element based on the expression provided to the ngShow attribute. (uses a
built in CSS class called ng-hide which sets the display to none with the !important flag)
AngularJS Documentation/Links
https://angularjs.org
https://docs.angularjs.org/api
http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-
background
https://egghead.io/technologies/angularjs?order=ASC

Más contenido relacionado

La actualidad más candente

Angularjs for kolkata drupal meetup
Angularjs for kolkata drupal meetupAngularjs for kolkata drupal meetup
Angularjs for kolkata drupal meetup
Goutam Dey
 

La actualidad más candente (20)

AngularJS is awesome
AngularJS is awesomeAngularJS is awesome
AngularJS is awesome
 
AngularJS Beginners Workshop
AngularJS Beginners WorkshopAngularJS Beginners Workshop
AngularJS Beginners Workshop
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS intro
 
AngularJS Introduction
AngularJS IntroductionAngularJS Introduction
AngularJS Introduction
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Angularjs architecture
Angularjs architectureAngularjs architecture
Angularjs architecture
 
Angularjs basic part01
Angularjs basic part01Angularjs basic part01
Angularjs basic part01
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques
 
AngularJS Basics
AngularJS BasicsAngularJS Basics
AngularJS Basics
 
Step by Step - AngularJS
Step by Step - AngularJSStep by Step - AngularJS
Step by Step - AngularJS
 
Why angular js Framework
Why angular js Framework Why angular js Framework
Why angular js Framework
 
React vs-angular-mobile
React vs-angular-mobileReact vs-angular-mobile
React vs-angular-mobile
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Angular JS Indtrodution
Angular JS IndtrodutionAngular JS Indtrodution
Angular JS Indtrodution
 
Angularjs
AngularjsAngularjs
Angularjs
 
Angularjs for kolkata drupal meetup
Angularjs for kolkata drupal meetupAngularjs for kolkata drupal meetup
Angularjs for kolkata drupal meetup
 

Similar a Angular js

AgularJS basics- angular directives and controllers
AgularJS basics- angular directives and controllersAgularJS basics- angular directives and controllers
AgularJS basics- angular directives and controllers
jobinThomas54
 

Similar a Angular js (20)

Angular js
Angular jsAngular js
Angular js
 
One Weekend With AngularJS
One Weekend With AngularJSOne Weekend With AngularJS
One Weekend With 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
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
 
Angular js
Angular jsAngular js
Angular js
 
AngularJs Basic Concept
AngularJs Basic ConceptAngularJs Basic Concept
AngularJs Basic Concept
 
AngularJS in practice
AngularJS in practiceAngularJS in practice
AngularJS in practice
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
 
Integrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMSIntegrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMS
 
Wt unit 5 client & server side framework
Wt unit 5 client & server side frameworkWt unit 5 client & server side framework
Wt unit 5 client & server side framework
 
Angular - Beginner
Angular - BeginnerAngular - Beginner
Angular - Beginner
 
AgularJS basics- angular directives and controllers
AgularJS basics- angular directives and controllersAgularJS basics- angular directives and controllers
AgularJS basics- angular directives and controllers
 
Angular js
Angular jsAngular js
Angular js
 
Angular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad indiaAngular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad india
 
AngularJs
AngularJsAngularJs
AngularJs
 
Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01
 
AngularJS By Vipin
AngularJS By VipinAngularJS By Vipin
AngularJS By Vipin
 
AngularJS - A JavaScript Framework
AngularJS - A JavaScript FrameworkAngularJS - A JavaScript Framework
AngularJS - A JavaScript Framework
 
Angular introduction basic
Angular introduction basicAngular introduction basic
Angular introduction basic
 

Más de Larry Ball (6)

Swift
SwiftSwift
Swift
 
Comp325 v1 ww-ball-2-1
Comp325 v1 ww-ball-2-1Comp325 v1 ww-ball-2-1
Comp325 v1 ww-ball-2-1
 
Php debugging
Php debuggingPhp debugging
Php debugging
 
Object Oriented PHP Overview
Object Oriented PHP OverviewObject Oriented PHP Overview
Object Oriented PHP Overview
 
EISA Considerations for Web Application Security
EISA Considerations for Web Application SecurityEISA Considerations for Web Application Security
EISA Considerations for Web Application Security
 
jQueryUI
 jQueryUI jQueryUI
jQueryUI
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

Angular js

  • 2. Terminology MVC architecture • Model – data • View – template • Controller – code (JavaScript) that links views to models Scopes • Scope is an object that refers to the application model. It is an execution context for expressions. Scopes are arranged in a hierarchical structure which mimics the DOM structure of the application. Scopes can watch expressions and propagate events. https://docs.angularjs.org/guide/scope
  • 3. jQuery vs. AngularJS •In jQuery you design a page and then make it dynamic, changing it with DOM manipulations. •In AngularJS you design the architecture first, then your application, then your view (html template). You don’t alter the DOM (usually). •Think in terms of architecture – single page applications are applications, not webpages. You must think like a server-side developer as well as a front-end developer. •The view is the official record. By looking at it you can tell what directives are being applied. Much cleaner and concise than jQuery. •Data binding – most awesome feature of AngularJS. AngularJS updates the view so you don’t have to code DOM manipulations. •MVC architecture allows for a model completely separate from the view. In jQuery the DOM is the model.
  • 4. jQuery vs. AngularJS •Separation of concerns – your view shows what is supposed to happen, your model represents your data, there is a service layer to perform reusable tasks and you do DOM manipulations and augment the view with directives. All of this is glued together with controllers. •Dependency Injection – you can declare components and then from other component ask for an instance of it without worrying about loading order, file locations, etc. •Test Driven Development is possible with AngularJS; iterative only with jQuery. Source: stackoverflow.com (link provided on last slide). https://docs.angularjs.org/guide/directive
  • 5. Angular Directives ng-repeat ◦ Allows us to loop through an array ◦ https://docs.angularjs.org/api/ng/directive/ngRepeat ng-src ◦ Prevents images from loading until the Angular library loads ◦ https://docs.angularjs.org/api/ng/directive/ngSrc
  • 6. $scope vs. this http://stackoverflow.com/questions/11605917/this-vs-scope-in-angularjs-controllers this •When the controller constructor function is called, this is the controller •When a function defined on a $scope object is called, this is the “scope in effect” when the function was called. This may or may not be the $scope the function was defined on. Inside the function, this and $scope may not be the same. $scope •Every controller has an associated $scope object •A controller function (aka constructor) is responsible for setting model properties and functions/behavior on its associated $scope. •Only methods defined on this $scope are accessible from the HTML/view – ng-click, filters, etc.
  • 7. Angular Filters https://docs.angularjs.org/api/ng/filter/filter Selects a subset of items from array and returns it as a new array HTML template binding {{ filter_expression | filter : expression : comparator}} JavaScript $filter(‘filter’)(array, expression, comparator) Expression = string, object, or function (custom filters) Comparator = function (actual, expected), true – shorthand for function(actual, expected){return angular.equals(expected, actual)} , false/undefined (case insensitive match shorthand)
  • 8. ngRoute https://docs.angularjs.org/api/ngRoute Via routing we can access another Angular feature – deep linking Use the service $routeProvider() https://docs.angularjs.org/api/ngRoute/provider/$routeProvider Remember, AngularJS is used to create one page apps. With ngRoute we can simulate multiple pages.
  • 9. Animations https://docs.angularjs.org/guide/animations Assist with CSS animations https://docs.angularjs.org/api/ng/directive/ngShow Shows or hides the HTML element based on the expression provided to the ngShow attribute. (uses a built in CSS class called ng-hide which sets the display to none with the !important flag)