SlideShare a Scribd company logo
1 of 28
Download to read offline
A Presented By
Bharat Makwana
CTO, WOXI SOFTWARE LLP
Mr Bharat Makwana
Chief Technology Officer
WOXI SOFTWARE LLP
Catch me If you can at:
bharat.woxi@gmail.com
+91 956 111 9771
https://www.linkedin.com/in/makwanabharat/
Who Am I?
Objectives
● Overview
● Where AngularJs reside?
● MVC Architecture
● Core Features
● Pros & Cons
● Hello World in AngularJs
● Directives
● Expression
● Controllers
● Filters
● Tables
● Modules
● Includes
● Views
● Scope
● Services
● Dependency Injection
● Custom Directives
● Internationalization
● Introduction to NodeJs
Overview
What is AngularJS?
❖ AngularJS is an open source
web application framework.
❖ It was originally developed in
2009 by Misko Hevery and
Adam Abrons. It is now
maintained by Google.
❖ Its latest version is 1.6.7
Official Definition of
AngularJS
AngularJS is a structural framework for
dynamic web apps. It lets you use HTML as
your template language and lets you extend
HTML's syntax to express your application's
components clearly and succinctly.
Angular's data binding and dependency
injection eliminate much of the code you
currently have to write. And it all happens
within the browser, making it an ideal partner
with any server technology.
Where AngularJS reside?
MVC Architecture
Model View Controller or MVC as it is popularly called, is a software design
pattern for developing web applications. A Model View Controller pattern is made
up of the following three parts βˆ’
● Model βˆ’ It is the lowest level of the pattern responsible for maintaining data.
● View βˆ’ It is responsible for displaying all or a portion of the data to the user.
● Controller βˆ’ It is a software Code that controls the interactions between the
Model and View.
Core Features
Pros & Cons of AngularJs
Pros :
● AngularJS provides capability to create Single
Page Application in a very clean and
maintainable way.
● AngularJS provides data binding capability to
HTML thus giving user a rich and responsive
experience
● AngularJS code is unit testable.
● AngularJS uses dependency injection and
make use of separation of concerns.
● AngularJS provides reusable components.
● With AngularJS, developer write less code and
get more functionality.
● In AngularJS, views are pure html pages, and
controllers written in JavaScript do the business
processing
Cons :
Though AngularJS comes with lots of plus
points but same time we should consider the
following points βˆ’
● Not Secure βˆ’ Being JavaScript only
framework, application written in
AngularJS are not safe. Server side
authentication and authorization is must to
keep an application secure.
● Not degradable βˆ’ If your application user
disables JavaScript then user will just see
the basic page and nothing more.
The AngularJS Components
The AngularJS framework can be divided into following three major parts βˆ’
● ng-app βˆ’ This directive defines and links an AngularJS application to HTML.
● ng-model βˆ’ This directive binds the values of AngularJS application data to
HTML input controls.
● ng-bind βˆ’ This directive binds the AngularJS Application data to HTML tags.
Hello World in AngularJs
<html>
<head>
<title>AngularJS Hello World Application</title>
</head>
<body>
<h1>Say hello</h1>
<div ng-app = "">
<p>Enter your Name : <input type = "text" ng-model = "name"></p>
<p>Hello <span ng-bind = "name"></span>!</p>
</div>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script>
</body>
</html>
AngularJs - Directives
AngularJS directives are used to
extend HTML. These are special
attributes starting with ng- prefix.
We're going to discuss following
directives βˆ’
● ng-app βˆ’ This directive starts
an AngularJS Application.
● ng-init βˆ’ This directive
initializes application data.
● ng-model βˆ’ This directive
binds the values of
AngularJS application data to
HTML input controls.
● ng-repeat βˆ’ This directive
repeats html elements for
each item in a collection.
<html>
<head>
<title>AngularJS Directives</title>
</head>
<body>
<h1>Sample Application</h1>
<div ng-app = "" ng-init = "countries = [{locale:'en-US',name:'United States'},
{locale:'en-GB',name:'United Kingdom'}, {locale:'en-IN',name:India}]">
<p>Enter your Name: <input type = "text" ng-model = "name"></p>
<p>Hello <span ng-bind = "name"></span>!</p>
<p>List of Countries with locale:</p>
<ol>
<li ng-repeat = "country in countries">
{{ 'Country: ' + country.name + ', Locale: ' + country.locale }}
</li>
</ol>
</div>
<script src =”https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script>
</body>
</html>
AngularJs - Expressions
Expressions are used to bind
application data to html.
Expressions are written
inside double braces like {{
expression}}. Expressions
behaves in same way as
ng-bind directives.
● Using numbers
● Using strings
● Using object
● Using array
<html>
<head>
<title>AngularJS Expressions</title>
</head>
<body>
<h1>Sample Application</h1>
<div ng-app = "" ng-init = "quantity = 1;cost = 30; student =
{firstname:'Mahesh',lastname:'Parashar',rollno:101};marks = [80,90,75,73,60]">
<p>Hello {{student.firstname + " " + student.lastname}}!</p>
<p>Expense on Books : {{cost * quantity}} Rs</p>
<p>Roll No: {{student.rollno}}</p>
<p>Marks(Math): {{marks[3]}}</p>
</div>
<script src =
"https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script>
</body>
</html>
AngularJs - Controllers
● AngularJS application
mainly relies on controllers
to control the flow of data
in the application.
● A controller is defined
using ng-controller
directive.
● A controller is a JavaScript
object containing
attributes/properties and
functions.
● Each controller accepts
$scope as a parameter
which refers to the
application/module that
controller is to control.
<div ng-app = "" ng-controller = "studentController">
...
</div>
<script>
function studentController($scope) {
$scope.student = {
firstName: "Mahesh",
lastName: "Parashar",
fullName: function() {
var studentObject;
studentObject = $scope.student;
return studentObject.firstName + " " + studentObject.lastName;
}
};
}
</script>Enter first name: <input type = "text" ng-model = "student.firstName"><br>
Enter last name: <input type = "text" ng-model = "student.lastName"><br>
You are entering: {{student.fullName()}}
AngularJs - Filters
● Filters are used to
change modify
the data and can
be clubbed in
expression or
directives using
pipe character.
● Uppercase - converts a text to upper case text.
Enter first name:<input type = "text" ng-model = "student.firstName">
Enter last name: <input type = "text" ng-model = "student.lastName">
Name in Upper Case: {{student.fullName() | uppercase}}
● Orderby - orders the array based on provided criteria.
Subject:
<ul>
<li ng-repeat = "subject in student.subjects | orderBy:'marks'">
{{ subject.name + ', marks:' + subject.marks }}
</li>
</ul>
● Currency - formats text in a currency format.
● Lowercase - converts a text to lower case text.
● Filter - filter the array to a subset of it based on provided criteria.
AngularJs - Tables
● Table data is
normally
repeatable by
nature. ng-repeat
directive can be
used to draw
table easily.
<table>
<tr>
<th>Name</th>
<th>Marks</th>
</tr>
<tr ng-repeat = "subject in student.subjects">
<td>{{ subject.name }}</td>
<td>{{ subject.marks }}</td>
</tr>
</table>
AngularJs - Modules
AngularJS supports modular
approach. Modules are
used to separate logics
say services, controllers,
application etc. and keep
the code clean. We define
modules in separate js files
and name them as per the
module.js file.
● Application Module βˆ’
used to initialize an
application with
controller(s).
● Controller Module βˆ’ used
to define the controller.
Application Module - mainApp.js
var mainApp = angular.module("mainApp", []);
Controller Module - studentController.js
mainApp.controller("studentController", function($scope) {
$scope.student = {
firstName: "Mahesh", lastName: "Parashar", fees:500,
subjects:[ {name:'Hindi',marks:67} ],
fullName: function() {
var studentObject;
studentObject = $scope.student;
return studentObject.firstName + " " + studentObject.lastName;
}
};
});
Use Modules
<div ng-app = "mainApp" ng-controller = "studentController">
<script src = "mainApp.js"></script>
<script src = "studentController.js"></script>
</div>
AngularJs - Includes
HTML does not support
embedding html pages within
html page. To achieve this
functionality following ways are
used βˆ’
● Using Ajax βˆ’ Make a
server call to get the
corresponding html page
and set it in innerHTML of
html control.
● Using Server Side
Includes βˆ’ JSP, PHP and
other web side server
technologies can include
html pages within a
dynamic page.
Using AngularJS, we can embed HTML pages within a HTML page using
ng-include directive.
<div ng-app = "" ng-controller = "studentController">
<div ng-include = "'main.htm'"></div>
<div ng-include = "'subjects.htm'"></div>
</div>
AngularJs - Views
AngularJS supports Single Page Application via multiple views on a single page. To do this AngularJS has provided ng-view and
ng-template directives and $routeProvider services.
ng-view
ng-view tag simply creates a place holder where a corresponding view (html or ng-template view) can be placed based on the
configuration.
Usage
Define a div with ng-view within the main module.
<div ng-app = "mainApp">
<div ng-view></div>
</div>
AngularJs - Scope
Scope is a special javascript object which plays the role of joining controller with the views. Scope contains the model
data. In controllers, model data is accessed via $scope object.
<script>
var mainApp = angular.module("mainApp", []);
mainApp.controller("shapeController", function($scope) {
$scope.message = "In shape controller";
$scope.type = "Shape";
});
</script>
Following are the important points to be considered in above example.
● $scope is passed as first argument to controller during its constructor definition.
● $scope.message and $scope.type are the models which are to be used in the HTML page.
● We've set values to models which will be reflected in the application module whose controller is shapeController.
● We can define functions as well in $scope.
AngularJs - Services
AngularJS supports the concepts of "Separation of Concerns" using services architecture. Services are
javascript functions and are responsible to do a specific tasks only. This makes them an individual entity
which is maintainable and testable. Controllers, filters can call them as on requirement basis. Services
are normally injected using dependency injection mechanism of AngularJS.
AngularJS provides many inbuilt services for example, $https:, $route, $window, $location etc. Each
service is responsible for a specific task for example,
$https: is used to make ajax call to get the server data. $route is used to define the routing information
and so on.
Inbuilt services are always prefixed with $ symbol.
There are two ways to create a service. a) Factory b) service
AngularJs - Dependency Injection
Dependency Injection is a software design pattern in which components are given their dependencies
instead of hard coding them within the component. This relieves a component from locating the
dependency and makes dependencies configurable. This helps in making components reusable,
maintainable and testable.
AngularJS provides a supreme Dependency Injection mechanism. It provides following core components
which can be injected into each other as dependencies.
● value
● factory
● service
● provider
● constant
AngularJs - Custom Directives
Custom directives are used in AngularJS to extend the functionality of HTML. Custom directives are
defined using "directive" function. A custom directive simply replaces the element for which it is
activated. AngularJS application during bootstrap finds the matching elements and do one time activity
using its compile() method of the custom directive then process the element using link() method of the
custom directive based on the scope of the directive. AngularJS provides support to create custom
directives for following type of elements.
● Element directives βˆ’ Directive activates when a matching element is encountered.
● Attribute βˆ’ Directive activates when a matching attribute is encountered.
● CSS βˆ’ Directive activates when a matching css style is encountered.
● Comment βˆ’ Directive activates when a matching comment is encountered.
AngularJs - Internationalization
AngularJS supports inbuilt internationalization for three types of filters currency, date and numbers. We
only need to incorporate corresponding js according to locale of the country. By default it handles the
locale of the browser. For example, to use Danish locale, use following script.
<script src = "https://code.angularjs.org/1.2.5/i18n/angular-locale_da-dk.js"></script>
Introduction To
NodeJS
● Node.js is an open source
server framework
● Node.js is free
● Node.js runs on various
platforms (Windows, Linux,
Unix, Mac OS X, etc.)
● Node.js uses JavaScript on
the server
Why Node.Js?
Why Node.js?
Node.js uses asynchronous programming!
A common task for a web server can be to open a file on the server and return the
content to the client.
Here is how PHP or ASP handles a file request:
1. Sends the task to the computer's file system.
2. Waits while the file system opens and reads the file.
3. Returns the content to the client.
4. Ready to handle the next request.
Why Node.Js?
Here is how Node.js handles a file request:
1. Sends the task to the computer's file system.
2. Ready to handle the next request.
3. When the file system has opened and read the file, the server returns the
content to the client.
Node.js eliminates the waiting, and simply continues with the next request.
Node.js runs single-threaded, non-blocking, asynchronously programming, which
is very memory efficient.
Let’s Dive Together into the
World of AngularJs
Thank You
Any Questions?
Any Query?

More Related Content

What's hot

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
Β 
Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS FrameworkRaveendra R
Β 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework Camilo Lopes
Β 
AngularJS: Overview & Key Features
AngularJS: Overview & Key FeaturesAngularJS: Overview & Key Features
AngularJS: Overview & Key FeaturesMohamad Al Asmar
Β 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day WorkshopShyam Seshadri
Β 
Angularjs tutorial
Angularjs tutorialAngularjs tutorial
Angularjs tutorialHarikaReddy115
Β 
HTL(Sightly) - All you need to know
HTL(Sightly) - All you need to knowHTL(Sightly) - All you need to know
HTL(Sightly) - All you need to knowPrabhdeep Singh
Β 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to conceptsAbhishek Sur
Β 
Angular Project Report
 Angular Project Report Angular Project Report
Angular Project ReportKodexhub
Β 
Learn html and css from scratch
Learn html and css from scratchLearn html and css from scratch
Learn html and css from scratchMohd Manzoor Ahmed
Β 
Angular js
Angular jsAngular js
Angular jsMindtree
Β 
Introduction to Java Script
Introduction to Java ScriptIntroduction to Java Script
Introduction to Java ScriptVijay Kumar Verma
Β 
A quick guide to Css and java script
A quick guide to Css and  java scriptA quick guide to Css and  java script
A quick guide to Css and java scriptAVINASH KUMAR
Β 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle StudiosAngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle StudiosLearnimtactics
Β 
Introduction to Angular js 2.0
Introduction to Angular js 2.0Introduction to Angular js 2.0
Introduction to Angular js 2.0Nagaraju Sangam
Β 

What's hot (20)

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
Β 
Angular js
Angular jsAngular js
Angular js
Β 
Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS Framework
Β 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework
Β 
AngularJS: Overview & Key Features
AngularJS: Overview & Key FeaturesAngularJS: Overview & Key Features
AngularJS: Overview & Key Features
Β 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day Workshop
Β 
Angularjs tutorial
Angularjs tutorialAngularjs tutorial
Angularjs tutorial
Β 
HTL(Sightly) - All you need to know
HTL(Sightly) - All you need to knowHTL(Sightly) - All you need to know
HTL(Sightly) - All you need to know
Β 
Training On Angular Js
Training On Angular JsTraining On Angular Js
Training On Angular Js
Β 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
Β 
Angular Project Report
 Angular Project Report Angular Project Report
Angular Project Report
Β 
Angular js
Angular jsAngular js
Angular js
Β 
Learn html and css from scratch
Learn html and css from scratchLearn html and css from scratch
Learn html and css from scratch
Β 
Angular js
Angular jsAngular js
Angular js
Β 
Introduction to Java Script
Introduction to Java ScriptIntroduction to Java Script
Introduction to Java Script
Β 
A quick guide to Css and java script
A quick guide to Css and  java scriptA quick guide to Css and  java script
A quick guide to Css and java script
Β 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle StudiosAngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
Β 
Introduction to Angular js 2.0
Introduction to Angular js 2.0Introduction to Angular js 2.0
Introduction to Angular js 2.0
Β 
Angular js
Angular jsAngular js
Angular js
Β 
Mvc
MvcMvc
Mvc
Β 

Similar to Introduction to AngularJS By Bharat Makwana

AngularJS By Vipin
AngularJS By VipinAngularJS By Vipin
AngularJS By VipinVipin Mundayad
Β 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseEPAM Systems
Β 
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
Β 
The Basics Angular JS
The Basics Angular JS The Basics Angular JS
The Basics Angular JS OrisysIndia
Β 
Kalp Corporate Angular Js Tutorials
Kalp Corporate Angular Js TutorialsKalp Corporate Angular Js Tutorials
Kalp Corporate Angular Js TutorialsKalp Corporate
Β 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IVisual Engineering
Β 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to AngularjsGaurav Agrawal
Β 
Dive into AngularJS and directives
Dive into AngularJS and directivesDive into AngularJS and directives
Dive into AngularJS and directivesTricode (part of Dept)
Β 
AngularJs Basic Concept
AngularJs Basic ConceptAngularJs Basic Concept
AngularJs Basic ConceptHari Haran
Β 
Angular js interview question answer for fresher
Angular js interview question answer for fresherAngular js interview question answer for fresher
Angular js interview question answer for fresherRavi Bhadauria
Β 
One Weekend With AngularJS
One Weekend With AngularJSOne Weekend With AngularJS
One Weekend With AngularJSYashobanta Bai
Β 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSShyjal Raazi
Β 
Angular js
Angular jsAngular js
Angular jsSteve Fort
Β 
Angular Presentation
Angular PresentationAngular Presentation
Angular PresentationAdam Moore
Β 
angularjs_tutorial.docx
angularjs_tutorial.docxangularjs_tutorial.docx
angularjs_tutorial.docxtelegramvip
Β 
Angularjs overview
Angularjs  overviewAngularjs  overview
Angularjs overviewVickyCmd
Β 

Similar to Introduction to AngularJS By Bharat Makwana (20)

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
Β 
AngularJS By Vipin
AngularJS By VipinAngularJS By Vipin
AngularJS By Vipin
Β 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
Β 
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
Β 
The Basics Angular JS
The Basics Angular JS The Basics Angular JS
The Basics Angular JS
Β 
AngularJS
AngularJSAngularJS
AngularJS
Β 
Kalp Corporate Angular Js Tutorials
Kalp Corporate Angular Js TutorialsKalp Corporate Angular Js Tutorials
Kalp Corporate Angular Js Tutorials
Β 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
Β 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
Β 
Dive into AngularJS and directives
Dive into AngularJS and directivesDive into AngularJS and directives
Dive into AngularJS and directives
Β 
AngularJs
AngularJsAngularJs
AngularJs
Β 
AngularJs Basic Concept
AngularJs Basic ConceptAngularJs Basic Concept
AngularJs Basic Concept
Β 
Angular js interview question answer for fresher
Angular js interview question answer for fresherAngular js interview question answer for fresher
Angular js interview question answer for fresher
Β 
One Weekend With AngularJS
One Weekend With AngularJSOne Weekend With AngularJS
One Weekend With AngularJS
Β 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Β 
Angular js
Angular jsAngular js
Angular js
Β 
Angular Presentation
Angular PresentationAngular Presentation
Angular Presentation
Β 
Angular js slides
Angular js slidesAngular js slides
Angular js slides
Β 
angularjs_tutorial.docx
angularjs_tutorial.docxangularjs_tutorial.docx
angularjs_tutorial.docx
Β 
Angularjs overview
Angularjs  overviewAngularjs  overview
Angularjs overview
Β 

Recently uploaded

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
Β 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
Β 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
Β 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
Β 
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...Martijn de Jong
Β 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
Β 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
Β 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
Β 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
Β 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
Β 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
Β 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
Β 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
Β 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
Β 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
Β 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
Β 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
Β 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
Β 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
Β 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
Β 

Recently uploaded (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Β 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Β 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Β 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
Β 
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...
Β 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Β 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Β 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Β 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Β 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Β 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Β 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Β 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
Β 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Β 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Β 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Β 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Β 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Β 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Β 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
Β 

Introduction to AngularJS By Bharat Makwana

  • 1. A Presented By Bharat Makwana CTO, WOXI SOFTWARE LLP
  • 2. Mr Bharat Makwana Chief Technology Officer WOXI SOFTWARE LLP Catch me If you can at: bharat.woxi@gmail.com +91 956 111 9771 https://www.linkedin.com/in/makwanabharat/ Who Am I?
  • 3. Objectives ● Overview ● Where AngularJs reside? ● MVC Architecture ● Core Features ● Pros & Cons ● Hello World in AngularJs ● Directives ● Expression ● Controllers ● Filters ● Tables ● Modules ● Includes ● Views ● Scope ● Services ● Dependency Injection ● Custom Directives ● Internationalization ● Introduction to NodeJs
  • 4. Overview What is AngularJS? ❖ AngularJS is an open source web application framework. ❖ It was originally developed in 2009 by Misko Hevery and Adam Abrons. It is now maintained by Google. ❖ Its latest version is 1.6.7 Official Definition of AngularJS AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. Angular's data binding and dependency injection eliminate much of the code you currently have to write. And it all happens within the browser, making it an ideal partner with any server technology.
  • 6. MVC Architecture Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts βˆ’ ● Model βˆ’ It is the lowest level of the pattern responsible for maintaining data. ● View βˆ’ It is responsible for displaying all or a portion of the data to the user. ● Controller βˆ’ It is a software Code that controls the interactions between the Model and View.
  • 8. Pros & Cons of AngularJs Pros : ● AngularJS provides capability to create Single Page Application in a very clean and maintainable way. ● AngularJS provides data binding capability to HTML thus giving user a rich and responsive experience ● AngularJS code is unit testable. ● AngularJS uses dependency injection and make use of separation of concerns. ● AngularJS provides reusable components. ● With AngularJS, developer write less code and get more functionality. ● In AngularJS, views are pure html pages, and controllers written in JavaScript do the business processing Cons : Though AngularJS comes with lots of plus points but same time we should consider the following points βˆ’ ● Not Secure βˆ’ Being JavaScript only framework, application written in AngularJS are not safe. Server side authentication and authorization is must to keep an application secure. ● Not degradable βˆ’ If your application user disables JavaScript then user will just see the basic page and nothing more.
  • 9. The AngularJS Components The AngularJS framework can be divided into following three major parts βˆ’ ● ng-app βˆ’ This directive defines and links an AngularJS application to HTML. ● ng-model βˆ’ This directive binds the values of AngularJS application data to HTML input controls. ● ng-bind βˆ’ This directive binds the AngularJS Application data to HTML tags.
  • 10. Hello World in AngularJs <html> <head> <title>AngularJS Hello World Application</title> </head> <body> <h1>Say hello</h1> <div ng-app = ""> <p>Enter your Name : <input type = "text" ng-model = "name"></p> <p>Hello <span ng-bind = "name"></span>!</p> </div> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script> </body> </html>
  • 11. AngularJs - Directives AngularJS directives are used to extend HTML. These are special attributes starting with ng- prefix. We're going to discuss following directives βˆ’ ● ng-app βˆ’ This directive starts an AngularJS Application. ● ng-init βˆ’ This directive initializes application data. ● ng-model βˆ’ This directive binds the values of AngularJS application data to HTML input controls. ● ng-repeat βˆ’ This directive repeats html elements for each item in a collection. <html> <head> <title>AngularJS Directives</title> </head> <body> <h1>Sample Application</h1> <div ng-app = "" ng-init = "countries = [{locale:'en-US',name:'United States'}, {locale:'en-GB',name:'United Kingdom'}, {locale:'en-IN',name:India}]"> <p>Enter your Name: <input type = "text" ng-model = "name"></p> <p>Hello <span ng-bind = "name"></span>!</p> <p>List of Countries with locale:</p> <ol> <li ng-repeat = "country in countries"> {{ 'Country: ' + country.name + ', Locale: ' + country.locale }} </li> </ol> </div> <script src =”https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script> </body> </html>
  • 12. AngularJs - Expressions Expressions are used to bind application data to html. Expressions are written inside double braces like {{ expression}}. Expressions behaves in same way as ng-bind directives. ● Using numbers ● Using strings ● Using object ● Using array <html> <head> <title>AngularJS Expressions</title> </head> <body> <h1>Sample Application</h1> <div ng-app = "" ng-init = "quantity = 1;cost = 30; student = {firstname:'Mahesh',lastname:'Parashar',rollno:101};marks = [80,90,75,73,60]"> <p>Hello {{student.firstname + " " + student.lastname}}!</p> <p>Expense on Books : {{cost * quantity}} Rs</p> <p>Roll No: {{student.rollno}}</p> <p>Marks(Math): {{marks[3]}}</p> </div> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script> </body> </html>
  • 13. AngularJs - Controllers ● AngularJS application mainly relies on controllers to control the flow of data in the application. ● A controller is defined using ng-controller directive. ● A controller is a JavaScript object containing attributes/properties and functions. ● Each controller accepts $scope as a parameter which refers to the application/module that controller is to control. <div ng-app = "" ng-controller = "studentController"> ... </div> <script> function studentController($scope) { $scope.student = { firstName: "Mahesh", lastName: "Parashar", fullName: function() { var studentObject; studentObject = $scope.student; return studentObject.firstName + " " + studentObject.lastName; } }; } </script>Enter first name: <input type = "text" ng-model = "student.firstName"><br> Enter last name: <input type = "text" ng-model = "student.lastName"><br> You are entering: {{student.fullName()}}
  • 14. AngularJs - Filters ● Filters are used to change modify the data and can be clubbed in expression or directives using pipe character. ● Uppercase - converts a text to upper case text. Enter first name:<input type = "text" ng-model = "student.firstName"> Enter last name: <input type = "text" ng-model = "student.lastName"> Name in Upper Case: {{student.fullName() | uppercase}} ● Orderby - orders the array based on provided criteria. Subject: <ul> <li ng-repeat = "subject in student.subjects | orderBy:'marks'"> {{ subject.name + ', marks:' + subject.marks }} </li> </ul> ● Currency - formats text in a currency format. ● Lowercase - converts a text to lower case text. ● Filter - filter the array to a subset of it based on provided criteria.
  • 15. AngularJs - Tables ● Table data is normally repeatable by nature. ng-repeat directive can be used to draw table easily. <table> <tr> <th>Name</th> <th>Marks</th> </tr> <tr ng-repeat = "subject in student.subjects"> <td>{{ subject.name }}</td> <td>{{ subject.marks }}</td> </tr> </table>
  • 16. AngularJs - Modules AngularJS supports modular approach. Modules are used to separate logics say services, controllers, application etc. and keep the code clean. We define modules in separate js files and name them as per the module.js file. ● Application Module βˆ’ used to initialize an application with controller(s). ● Controller Module βˆ’ used to define the controller. Application Module - mainApp.js var mainApp = angular.module("mainApp", []); Controller Module - studentController.js mainApp.controller("studentController", function($scope) { $scope.student = { firstName: "Mahesh", lastName: "Parashar", fees:500, subjects:[ {name:'Hindi',marks:67} ], fullName: function() { var studentObject; studentObject = $scope.student; return studentObject.firstName + " " + studentObject.lastName; } }; }); Use Modules <div ng-app = "mainApp" ng-controller = "studentController"> <script src = "mainApp.js"></script> <script src = "studentController.js"></script> </div>
  • 17. AngularJs - Includes HTML does not support embedding html pages within html page. To achieve this functionality following ways are used βˆ’ ● Using Ajax βˆ’ Make a server call to get the corresponding html page and set it in innerHTML of html control. ● Using Server Side Includes βˆ’ JSP, PHP and other web side server technologies can include html pages within a dynamic page. Using AngularJS, we can embed HTML pages within a HTML page using ng-include directive. <div ng-app = "" ng-controller = "studentController"> <div ng-include = "'main.htm'"></div> <div ng-include = "'subjects.htm'"></div> </div>
  • 18. AngularJs - Views AngularJS supports Single Page Application via multiple views on a single page. To do this AngularJS has provided ng-view and ng-template directives and $routeProvider services. ng-view ng-view tag simply creates a place holder where a corresponding view (html or ng-template view) can be placed based on the configuration. Usage Define a div with ng-view within the main module. <div ng-app = "mainApp"> <div ng-view></div> </div>
  • 19. AngularJs - Scope Scope is a special javascript object which plays the role of joining controller with the views. Scope contains the model data. In controllers, model data is accessed via $scope object. <script> var mainApp = angular.module("mainApp", []); mainApp.controller("shapeController", function($scope) { $scope.message = "In shape controller"; $scope.type = "Shape"; }); </script> Following are the important points to be considered in above example. ● $scope is passed as first argument to controller during its constructor definition. ● $scope.message and $scope.type are the models which are to be used in the HTML page. ● We've set values to models which will be reflected in the application module whose controller is shapeController. ● We can define functions as well in $scope.
  • 20. AngularJs - Services AngularJS supports the concepts of "Separation of Concerns" using services architecture. Services are javascript functions and are responsible to do a specific tasks only. This makes them an individual entity which is maintainable and testable. Controllers, filters can call them as on requirement basis. Services are normally injected using dependency injection mechanism of AngularJS. AngularJS provides many inbuilt services for example, $https:, $route, $window, $location etc. Each service is responsible for a specific task for example, $https: is used to make ajax call to get the server data. $route is used to define the routing information and so on. Inbuilt services are always prefixed with $ symbol. There are two ways to create a service. a) Factory b) service
  • 21. AngularJs - Dependency Injection Dependency Injection is a software design pattern in which components are given their dependencies instead of hard coding them within the component. This relieves a component from locating the dependency and makes dependencies configurable. This helps in making components reusable, maintainable and testable. AngularJS provides a supreme Dependency Injection mechanism. It provides following core components which can be injected into each other as dependencies. ● value ● factory ● service ● provider ● constant
  • 22. AngularJs - Custom Directives Custom directives are used in AngularJS to extend the functionality of HTML. Custom directives are defined using "directive" function. A custom directive simply replaces the element for which it is activated. AngularJS application during bootstrap finds the matching elements and do one time activity using its compile() method of the custom directive then process the element using link() method of the custom directive based on the scope of the directive. AngularJS provides support to create custom directives for following type of elements. ● Element directives βˆ’ Directive activates when a matching element is encountered. ● Attribute βˆ’ Directive activates when a matching attribute is encountered. ● CSS βˆ’ Directive activates when a matching css style is encountered. ● Comment βˆ’ Directive activates when a matching comment is encountered.
  • 23. AngularJs - Internationalization AngularJS supports inbuilt internationalization for three types of filters currency, date and numbers. We only need to incorporate corresponding js according to locale of the country. By default it handles the locale of the browser. For example, to use Danish locale, use following script. <script src = "https://code.angularjs.org/1.2.5/i18n/angular-locale_da-dk.js"></script>
  • 24. Introduction To NodeJS ● Node.js is an open source server framework ● Node.js is free ● Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.) ● Node.js uses JavaScript on the server
  • 25. Why Node.Js? Why Node.js? Node.js uses asynchronous programming! A common task for a web server can be to open a file on the server and return the content to the client. Here is how PHP or ASP handles a file request: 1. Sends the task to the computer's file system. 2. Waits while the file system opens and reads the file. 3. Returns the content to the client. 4. Ready to handle the next request.
  • 26. Why Node.Js? Here is how Node.js handles a file request: 1. Sends the task to the computer's file system. 2. Ready to handle the next request. 3. When the file system has opened and read the file, the server returns the content to the client. Node.js eliminates the waiting, and simply continues with the next request. Node.js runs single-threaded, non-blocking, asynchronously programming, which is very memory efficient.
  • 27. Let’s Dive Together into the World of AngularJs