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
 
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
 
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

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
 
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 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

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

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