SlideShare a Scribd company logo
AngularJs
An introduction
Outline
●   What is Angular
●   Why Angular
●   How Angular
●   Angular world vs JQuery world
●   Where to use
●   Where not to use
●   Why it is special
What is Angular




     HTML enhanced for web apps!
What is Angular

A Javascript library that allows you to

● EXTEND the functionalities of HTML
● model-view view-model BINDING
● Segregate javascipt logic from HTML
  rendering
● Provides MVC framework for the messy
  javascript
Why Angular
EXTEND the functionalities of HTML

HTML
<input size="30" type="text" class="richtext"/>


Angular way
<input size="30" type="richtext"/>
Why Angular
WHY EXTEND the functionalities of HTML?
● HTML is not enough, we need
  ○   Rich text
  ○   Date picker
  ○   Iterator for dynamic contents
  ○   etc...
● HTML is build to show static data
  ○ Angular makes HTML dynamic
Why Angular
model-view view-model BINDING

● Any changes in javascript model will impact
  the HTML view
● Any changes in HTML view will impact the
  javascript model
Why Angular
model-view view-model BINDING

HTML
<input size="30" type="text" ng-model="checkIn.
start_date"/>

Javascript
function CheckInsCtrl($scope) {
  $scope.checkIn = {start_date: '2013-02-13'};
}
Why Angular
Segregate javascipt logic from HTML
rendering

Advantage
● Helps to reuse logic as it is not coupled with
  HTML DOM
● Less coupling with the framework itself, as
  the library written with plain javascript.
How Angular
HTML

<html>
  <head>
     <script src="angular.js"></script>
  </head>
  <body ng-app>
   {{checkIn.rooms_count}}
  </body>
</html>

● Add angular js in the header
● Add ng-app in the body
How Angular
Javascript

function CheckInsCtrl($scope) {
  $scope.checkIn = {rooms_count: 0};
}


● Define controller and binding data
How Angular :: expression
Javascript
function CheckInsCtrl($scope) {
  $scope.checkIn = {rooms_count: 0};
}

HTML
{{checkIn.rooms_count}}


● Use {{}} to represent expression
● Anguler is forgiving for expression evaluation
How Angular :: binding
HTML
<input ng-datepicker type="text" ng-model="checkIn.start_date"/>
<input ng-datepicker type="text" ng-model="checkIn.end_date"/>
<select ng-model="checkIn.night_counts">
   <option value="1">1</option>
   <option value="2">2</option>
   <option value="3">3</option>
   ...
</select>



● Use ng-model to bind with controller data
How Angular :: binding
Javascript

function CheckInsCtrl($scope) {
  $scope.checkIn = {start_date: '2013-02-16 12:00 AM',
     end_date: '2013-02-17 12:00 AM',
     night_counts: 1};
}



● Define model data
How Angular :: watching
Javascript
Observe changes with $watch
function CheckInsCtrl($scope) {
  $scope.checkIn = {start_date: '2013-02-16 12:00 AM',
     end_date: '2013-02-17 12:00 AM',
     night_counts: 1};

    $scope.$watch('checkIn.start_date + checkIn.end_date', function () {
        if (isValidMoment($scope.checkIn.start_date)
            && isValidMoment($scope.checkIn.end_date)) {
            $scope.updateNightCount();
        }
    });
}
Angular world vs JQuery world
● Accessing angular from jquery
● Accessing jquery from angular
Accessing angular from jquery
Dom generated by angular

<div ng-controller="CheckInsCtrl" class="ng-scope">
  ....
</div>

A scope is defined at the root element.
Accessing angular from jquery
Scope can be accessed as following,

var scope = $(elem).scope();


But the elem should have the "ng-scope"
class.
Which denotes that there is a scope bound with
that element.
Accessing angular from jquery

<div ng-controller="CheckInsCtrl" class="ng-scope">
  ....
</div>


var scope = $($('[ng-controller="CheckInsCtrl"]')[0]).
scope();

Root scope is defined at the root element.
Accessing jquery from angular
Angular can access dom by,
● Angular directives
Where to use Angular
● Complex user end UI
  ○ Where you have a lot of dom event and dom
    manipulation
● One page application
Where not to use Angular
● It is a overkill for simple application where
  you do not need a lot of client side logic
Why it is special
● The target of angular is uniq
● It helps you to extend HTML
  ○ Add new attribute, element that the browser will
    understand
● It operates on dom, unlike other libraries
  that operates on template libraries(String
  based parsing)
● Can use a plain Javascript Hash for a
  model object, unlike EmberJs
References
● angularjs.org
● slideshare.net/AgentK/angularjs-for-
  designers-and-developers
Author

A.K.M. Ashrafuzzaman
Lead Software Engineer,
Tasawr Interactive

www.ashrafuzzaman.com
zmn.ashraf@gmail.com

More Related Content

PPTX
Top 10 Mistakes AngularJS Developers Make
PPTX
Angularjs Anti-patterns
ODP
AngularJs Crash Course
PDF
AngularJS Basics with Example
PDF
Angular js 2.0, ng poznań 20.11
PDF
An introduction to Angular2
DOCX
Filters in AngularJS
PDF
Ultimate Introduction To AngularJS
Top 10 Mistakes AngularJS Developers Make
Angularjs Anti-patterns
AngularJs Crash Course
AngularJS Basics with Example
Angular js 2.0, ng poznań 20.11
An introduction to Angular2
Filters in AngularJS
Ultimate Introduction To AngularJS

What's hot (20)

PPTX
AngularJS for Java Developers
PDF
AngularJS Workshop
PDF
How Angular2 Can Improve Your AngularJS Apps Today!
PPTX
AngularJS (1.x) as fast as a lightning
PPTX
Angular js 2
PPTX
AngularJS Introduction
PPTX
Combining Angular and React Together
PDF
Ngrx meta reducers
PDF
Routing to components
PDF
Overview of the AngularJS framework
PDF
Workshop 12: AngularJS Parte I
PPTX
AngularJS Internal
PPTX
Upgrading from Angular 1.x to Angular 2.x
PPTX
Angularjs
PDF
Angular server side rendering - Strategies & Technics
PPTX
AngularJs $provide API internals & circular dependency problem.
PPTX
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
ODP
Ractive js
PPT
Understanding AJAX
PDF
Workshop 14: AngularJS Parte III
AngularJS for Java Developers
AngularJS Workshop
How Angular2 Can Improve Your AngularJS Apps Today!
AngularJS (1.x) as fast as a lightning
Angular js 2
AngularJS Introduction
Combining Angular and React Together
Ngrx meta reducers
Routing to components
Overview of the AngularJS framework
Workshop 12: AngularJS Parte I
AngularJS Internal
Upgrading from Angular 1.x to Angular 2.x
Angularjs
Angular server side rendering - Strategies & Technics
AngularJs $provide API internals & circular dependency problem.
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Ractive js
Understanding AJAX
Workshop 14: AngularJS Parte III
Ad

Viewers also liked (12)

PDF
Preparing our students for Web 3.0 learning
PDF
Trigger Agency Profile - Advertising and Digital Marketing Services
PDF
My Amsterdam (presented at SDinGov 2017)
PPT
Web Security
PDF
Hampton Roads AMA - 2017 Trends in Digital Marketing
PPTX
Xu hướng Digital marketing 2016 -2017 - 2018 - bản đầy đủ nhất Thế giới
PDF
The Next Big Thing is Web 3.0. Catch It If You Can
PDF
We Create Digital Success Stories!
PDF
Mix Digital Marketing Agency Credentials
PDF
TEN Creative Design Agency Creds
PDF
LEAP Agency Company Profile
Preparing our students for Web 3.0 learning
Trigger Agency Profile - Advertising and Digital Marketing Services
My Amsterdam (presented at SDinGov 2017)
Web Security
Hampton Roads AMA - 2017 Trends in Digital Marketing
Xu hướng Digital marketing 2016 -2017 - 2018 - bản đầy đủ nhất Thế giới
The Next Big Thing is Web 3.0. Catch It If You Can
We Create Digital Success Stories!
Mix Digital Marketing Agency Credentials
TEN Creative Design Agency Creds
LEAP Agency Company Profile
Ad

Similar to Angular js - the beginning (20)

PPT
Coffee@DBG - Exploring Angular JS
PPTX
Angular js
PDF
Integrating AngularJS into the Campus CMS
PPTX
Angular workshop - Full Development Guide
PPTX
Intro to AngularJs
PPTX
AgularJS basics- angular directives and controllers
PPTX
Angular
PPTX
Angular
PDF
AngularJS Basics
PDF
Dive into AngularJS and directives
PPTX
ANGULAR JS TRAINING IN PUNE
PDF
Angular.js опыт использования, проблемы и решения
PPTX
Angular js
PDF
Introduction to AngularJS For WordPress Developers
PDF
One Weekend With AngularJS
PPTX
Angular js for Beginnners
PPTX
Angular JS Training Courses
PDF
Introduction of angular js
PPTX
Angular Js Basics
Coffee@DBG - Exploring Angular JS
Angular js
Integrating AngularJS into the Campus CMS
Angular workshop - Full Development Guide
Intro to AngularJs
AgularJS basics- angular directives and controllers
Angular
Angular
AngularJS Basics
Dive into AngularJS and directives
ANGULAR JS TRAINING IN PUNE
Angular.js опыт использования, проблемы и решения
Angular js
Introduction to AngularJS For WordPress Developers
One Weekend With AngularJS
Angular js for Beginnners
Angular JS Training Courses
Introduction of angular js
Angular Js Basics

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PPTX
Cloud computing and distributed systems.
Unlocking AI with Model Context Protocol (MCP)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The AUB Centre for AI in Media Proposal.docx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Spectroscopy.pptx food analysis technology
Big Data Technologies - Introduction.pptx
Spectral efficient network and resource selection model in 5G networks
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Chapter 3 Spatial Domain Image Processing.pdf
A comparative analysis of optical character recognition models for extracting...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
Cloud computing and distributed systems.

Angular js - the beginning

  • 2. Outline ● What is Angular ● Why Angular ● How Angular ● Angular world vs JQuery world ● Where to use ● Where not to use ● Why it is special
  • 3. What is Angular HTML enhanced for web apps!
  • 4. What is Angular A Javascript library that allows you to ● EXTEND the functionalities of HTML ● model-view view-model BINDING ● Segregate javascipt logic from HTML rendering ● Provides MVC framework for the messy javascript
  • 5. Why Angular EXTEND the functionalities of HTML HTML <input size="30" type="text" class="richtext"/> Angular way <input size="30" type="richtext"/>
  • 6. Why Angular WHY EXTEND the functionalities of HTML? ● HTML is not enough, we need ○ Rich text ○ Date picker ○ Iterator for dynamic contents ○ etc... ● HTML is build to show static data ○ Angular makes HTML dynamic
  • 7. Why Angular model-view view-model BINDING ● Any changes in javascript model will impact the HTML view ● Any changes in HTML view will impact the javascript model
  • 8. Why Angular model-view view-model BINDING HTML <input size="30" type="text" ng-model="checkIn. start_date"/> Javascript function CheckInsCtrl($scope) { $scope.checkIn = {start_date: '2013-02-13'}; }
  • 9. Why Angular Segregate javascipt logic from HTML rendering Advantage ● Helps to reuse logic as it is not coupled with HTML DOM ● Less coupling with the framework itself, as the library written with plain javascript.
  • 10. How Angular HTML <html> <head> <script src="angular.js"></script> </head> <body ng-app> {{checkIn.rooms_count}} </body> </html> ● Add angular js in the header ● Add ng-app in the body
  • 11. How Angular Javascript function CheckInsCtrl($scope) { $scope.checkIn = {rooms_count: 0}; } ● Define controller and binding data
  • 12. How Angular :: expression Javascript function CheckInsCtrl($scope) { $scope.checkIn = {rooms_count: 0}; } HTML {{checkIn.rooms_count}} ● Use {{}} to represent expression ● Anguler is forgiving for expression evaluation
  • 13. How Angular :: binding HTML <input ng-datepicker type="text" ng-model="checkIn.start_date"/> <input ng-datepicker type="text" ng-model="checkIn.end_date"/> <select ng-model="checkIn.night_counts"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> ... </select> ● Use ng-model to bind with controller data
  • 14. How Angular :: binding Javascript function CheckInsCtrl($scope) { $scope.checkIn = {start_date: '2013-02-16 12:00 AM', end_date: '2013-02-17 12:00 AM', night_counts: 1}; } ● Define model data
  • 15. How Angular :: watching Javascript Observe changes with $watch function CheckInsCtrl($scope) { $scope.checkIn = {start_date: '2013-02-16 12:00 AM', end_date: '2013-02-17 12:00 AM', night_counts: 1}; $scope.$watch('checkIn.start_date + checkIn.end_date', function () { if (isValidMoment($scope.checkIn.start_date) && isValidMoment($scope.checkIn.end_date)) { $scope.updateNightCount(); } }); }
  • 16. Angular world vs JQuery world ● Accessing angular from jquery ● Accessing jquery from angular
  • 17. Accessing angular from jquery Dom generated by angular <div ng-controller="CheckInsCtrl" class="ng-scope"> .... </div> A scope is defined at the root element.
  • 18. Accessing angular from jquery Scope can be accessed as following, var scope = $(elem).scope(); But the elem should have the "ng-scope" class. Which denotes that there is a scope bound with that element.
  • 19. Accessing angular from jquery <div ng-controller="CheckInsCtrl" class="ng-scope"> .... </div> var scope = $($('[ng-controller="CheckInsCtrl"]')[0]). scope(); Root scope is defined at the root element.
  • 20. Accessing jquery from angular Angular can access dom by, ● Angular directives
  • 21. Where to use Angular ● Complex user end UI ○ Where you have a lot of dom event and dom manipulation ● One page application
  • 22. Where not to use Angular ● It is a overkill for simple application where you do not need a lot of client side logic
  • 23. Why it is special ● The target of angular is uniq ● It helps you to extend HTML ○ Add new attribute, element that the browser will understand ● It operates on dom, unlike other libraries that operates on template libraries(String based parsing) ● Can use a plain Javascript Hash for a model object, unlike EmberJs
  • 25. Author A.K.M. Ashrafuzzaman Lead Software Engineer, Tasawr Interactive www.ashrafuzzaman.com zmn.ashraf@gmail.com