SlideShare a Scribd company logo
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

PDF
AngularJS 101 - Everything you need to know to get started
PPTX
Angular js PPT
PDF
Modern Web Application Development Workflow - EclipseCon Europe 2014
PPTX
Introduction to AngularJS
PDF
AngularJS: an introduction
PPTX
Angular Js Advantages - Complete Reference
PPTX
Angular js
AngularJS 101 - Everything you need to know to get started
Angular js PPT
Modern Web Application Development Workflow - EclipseCon Europe 2014
Introduction to AngularJS
AngularJS: an introduction
Angular Js Advantages - Complete Reference
Angular js

What's hot (20)

PPTX
Angular js 1.3 presentation for fed nov 2014
PDF
Angular js
PPTX
Introduction to AngularJS Framework
PPTX
Overview about AngularJS Framework
PDF
AngularJS: Overview & Key Features
PPTX
AngularJS One Day Workshop
PDF
Angularjs tutorial
PPTX
HTL(Sightly) - All you need to know
PPTX
Training On Angular Js
PPTX
Angular JS, A dive to concepts
PDF
Angular Project Report
DOCX
Angular js
PPTX
Learn html and css from scratch
PPTX
Angular js
PPTX
Introduction to Java Script
PPT
A quick guide to Css and java script
PPTX
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
PPTX
Introduction to Angular js 2.0
PPTX
Angular js
PPTX
Angular js 1.3 presentation for fed nov 2014
Angular js
Introduction to AngularJS Framework
Overview about AngularJS Framework
AngularJS: Overview & Key Features
AngularJS One Day Workshop
Angularjs tutorial
HTL(Sightly) - All you need to know
Training On Angular Js
Angular JS, A dive to concepts
Angular Project Report
Angular js
Learn html and css from scratch
Angular js
Introduction to Java Script
A quick guide to Css and java script
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
Introduction to Angular js 2.0
Angular js
Ad

Similar to Introduction to AngularJS By Bharat Makwana (20)

PPTX
Angular Javascript Tutorial with command
PDF
Wt unit 5 client &amp; server side framework
PDF
AngularJS By Vipin
PPTX
Angular Js Get Started - Complete Course
PPTX
Learning AngularJS - Complete coverage of AngularJS features and concepts
PPTX
The Basics Angular JS
PPTX
Kalp Corporate Angular Js Tutorials
PDF
Workshop 12: AngularJS Parte I
PPTX
Intoduction to Angularjs
PDF
Dive into AngularJS and directives
PPTX
AngularJS Introduction, how to run Angular
PPTX
AngularJs
PPTX
AngularJs Basic Concept
PDF
Angular js interview question answer for fresher
PDF
One Weekend With AngularJS
PPTX
Introduction to AngularJS
PPTX
Angular js
PPTX
Angular Presentation
PPTX
Angular js slides
Angular Javascript Tutorial with command
Wt unit 5 client &amp; server side framework
AngularJS By Vipin
Angular Js Get Started - Complete Course
Learning AngularJS - Complete coverage of AngularJS features and concepts
The Basics Angular JS
Kalp Corporate Angular Js Tutorials
Workshop 12: AngularJS Parte I
Intoduction to Angularjs
Dive into AngularJS and directives
AngularJS Introduction, how to run Angular
AngularJs
AngularJs Basic Concept
Angular js interview question answer for fresher
One Weekend With AngularJS
Introduction to AngularJS
Angular js
Angular Presentation
Angular js slides
Ad

Recently uploaded (20)

PDF
Doc9.....................................
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Smarter Business Operations Powered by IoT Remote Monitoring
PDF
Top Generative AI Tools for Patent Drafting in 2025.pdf
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
PDF
creating-agentic-ai-solutions-leveraging-aws.pdf
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Chapter 2 Digital Image Fundamentals.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Reimagining Insurance: Connected Data for Confident Decisions.pdf
PDF
DevOps & Developer Experience Summer BBQ
PDF
Revolutionize Operations with Intelligent IoT Monitoring and Control
PDF
Why Endpoint Security Is Critical in a Remote Work Era?
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PDF
CIFDAQ's Token Spotlight: SKY - A Forgotten Giant's Comeback?
PDF
SparkLabs Primer on Artificial Intelligence 2025
Doc9.....................................
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Smarter Business Operations Powered by IoT Remote Monitoring
Top Generative AI Tools for Patent Drafting in 2025.pdf
A Day in the Life of Location Data - Turning Where into How.pdf
creating-agentic-ai-solutions-leveraging-aws.pdf
madgavkar20181017ppt McKinsey Presentation.pdf
Chapter 2 Digital Image Fundamentals.pdf
Understanding_Digital_Forensics_Presentation.pptx
Reimagining Insurance: Connected Data for Confident Decisions.pdf
DevOps & Developer Experience Summer BBQ
Revolutionize Operations with Intelligent IoT Monitoring and Control
Why Endpoint Security Is Critical in a Remote Work Era?
GamePlan Trading System Review: Professional Trader's Honest Take
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
CIFDAQ's Token Spotlight: SKY - A Forgotten Giant's Comeback?
SparkLabs Primer on Artificial Intelligence 2025

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: [email protected] +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