SlideShare a Scribd company logo
ANGULARJS DEVELOPER
SHREYA BADIANI
kalpcorporateinfo@kalpcorporate.comkalpcorporate.com
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.
 https://angularjs.org
FEATURES
 AngularJS is a powerful JavaScript based development
framework to create RICH Internet Application(RIA).
 AngularJS provides developers options to write client
side application (using JavaScript) in a clean MVC(Model
View Controller) way.
 Application written in AngularJS is cross-browser
compliant. AngularJS automatically handles JavaScript
code suitable for each browser.
 AngularJS is open source, completely free, and used by
thousands of developers around the world. It is licensed
under the Apache License version 2.0.
IMPORTANT PARTS OF ANGULARJS
FEATURES
 Data-binding − It is the automatic synchronization of data
between model and view components.
 Scope − These are objects that refer to the model. They act as a
glue between controller and view.
 Controller − These are JavaScript functions that are bound to a
particular scope.
 Services − AngularJS come with several built-in services for
example $http to make a XMLHttpRequests. These are singleton
objects which are instantiated only once in app.
 Filters − These select a subset of items from an array and
returns a new array.
 Directives − Directives are markers on DOM elements (such as
elements, attributes, css, and more). These can be used to
create custom HTML tags that serve as new, custom widgets.
AngularJS has built-in directives (ngBind, ngModel...)
 Templates − These are the rendered view with information from
the controller and model. These can be a single file (like
index.html) or multiple views in one page using "partials".
 Routing − It is concept of switching views.
FEATURES
 Model View controller − MVC is a design pattern
for dividing an application into different parts (called
Model, View and Controller), each with distinct
responsibilities. AngularJS does not implement
MVC in the traditional sense, but rather something
closer to MVVM (Model-View-ViewModel). The
Angular JS team refers it humorously as Model
View Whatever.
 Dependency Injection − AngularJS has a built-in
dependency injection subsystem that helps the
developer by making the application easier to
develop, understand, and test.
ADVANTAGES OF ANGULARJS
 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.
DISADVANTAGES OF ANGULARJS
 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
 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.
MVC
MVC
 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.
STEPS TO CREATE ANGULARJS APP
Step-1
 We have included the AngularJS JavaScript file in
the HTML page so we can use AngularJS −
<script src =
"http://ajax.googleapis.com/ajax/libs/angularjs/1
.3.14/angular.min.js"> </script>
Step-2
 Define AngularJS Application using ng-app directive
<body ng-app = "myapp"> </body>
STEPS(CONTI..)
Step 3
 Define a model name using ng-model directive
<p>Enter your Name: <input type = "text" ng-
model = "name"></p>
Step-4
Bind the value of above model defined using ng-bind
directive.
 <p>Hello <span ng-bind = "name"></span>!</p>
HOW ANGULARJS INTEGRATES WITH
HTML
 ng-app directive indicates the start of AngularJS
application.
 ng-model directive then creates a model variable
named "name" which can be used with the html
page and within the div having ng-app directive.
 ng-bind uses the name model to be displayed in the
html span tag whenever user input something in the
text box.
 Closing</div> tag indicates the end of AngularJS
application
USE ABOVE MENTIONED THREE STEPS IN AN HTML
PAGE.
<html>
<head>
<title>AngularJS First Application</title> </head>
<body>
<h1>Sample Application</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 =
"http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.
min.js">
</script>
</body>
</html>
OUTPUT
Sample Application
Enter your Name:
Hello !
EXPRESSION
 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. AngularJS application
expressions are pure javascript expressions and
outputs the data where they are used.
 <p>Hello {{student.firstname + " " +
student.lastname}}!</p>
CONTROLLER
 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>
FILTER
 Filters are used to change modify the data and can
be clubbed in expression or directives using pipe
character. Following is the list of commonly used
filters.
Sr.No. Name Description
1 uppercase converts a text to
upper case text.
2 lowercase converts a text to
lower case text.
3 currency formats text in a
currency format.
4 filter filter the array to a
subset of it based on
provided criteria.
5 orderby orders the array based
on provided criteria.
MODULE
 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. In this
example we're going to create two modules.
 Application Module − used to initialize an
application with controller(s).
var mainApp = angular.module("mainApp", []);
MODULE(CONTI..)
 Controller Module − used to define the controller.
mainApp.controller("studentController",
function($scope) {
……
…
});
AJAX CALL:
 AngularJS provides $http control which works as a
service to read data from the server. The server
makes a database call to get the desired records.
AngularJS needs data in JSON format. Once the
data is ready, $http can be used to get the data
from server
$ROUTE
 $routeProvider is the key service which set the
configuration of urls, map them with the
corresponding html page or ng-template, and attach
a controller with the same.
var mainApp = angular.module("mainApp", ['ngRoute']);
mainApp.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/addStudent', {
templateUrl: 'addStudent.htm', controller:
'AddStudentController'
}).
when('/viewStudents', {
templateUrl: 'viewStudents.htm', controller:
'ViewStudentsController'
}).
otherwise({
redirectTo: '/addStudent'
});
}]);
LINKS
 https://angularjs.org/
 http://campus.codeschool.com/courses/shaping-up-
with-angular-js/contents
 John papa
Our online IM Id’s for more convenient
communication.
3, Suvarna Nagar Bungalow,
Near St.Xaviers School Loyola,
Ahmedabad-380013, Gujarat, India
+91 9879518121
+91 757-294-0388
(001) 415 251 KALP
kalpcorporate
nihar.kalp
nihar@kalpcorporate.com
info@kalpcorporate.com
md@kalpcorporate.com
kalpcorporate.com

More Related Content

What's hot (19)

Angular Seminar-js
Angular Seminar-js
Mindfire Solutions
 
AngularJS
AngularJS
Maurice De Beijer [MVP]
 
Introduction to AngularJS Framework
Introduction to AngularJS Framework
Raveendra R
 
Angular JS - Develop Responsive Single Page Application
Angular JS - Develop Responsive Single Page Application
Edureka!
 
Introduction to AngularJS
Introduction to AngularJS
David Parsons
 
Angular.js interview questions
Angular.js interview questions
codeandyou forums
 
Angular js
Angular js
Mindtree
 
Intoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
Different way to share data between controllers in angular js
Different way to share data between controllers in angular js
codeandyou forums
 
AngularJS: Overview & Key Features
AngularJS: Overview & Key Features
Mohamad Al Asmar
 
AngularJs (1.x) Presentation
AngularJs (1.x) Presentation
Raghubir Singh
 
Live Demo : Trending Angular JS Featues
Live Demo : Trending Angular JS Featues
Edureka!
 
Angular from Scratch
Angular from Scratch
Christian Lilley
 
Angular JS Introduction
Angular JS Introduction
Dhyego Fernando
 
The Basics Angular JS
The Basics Angular JS
OrisysIndia
 
Mean stack Magics
Mean stack Magics
Aishura Aishu
 
AngularJS interview questions
AngularJS interview questions
Uri Lukach
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
Angular js
Angular js
vu van quyet
 
Introduction to AngularJS Framework
Introduction to AngularJS Framework
Raveendra R
 
Angular JS - Develop Responsive Single Page Application
Angular JS - Develop Responsive Single Page Application
Edureka!
 
Introduction to AngularJS
Introduction to AngularJS
David Parsons
 
Angular.js interview questions
Angular.js interview questions
codeandyou forums
 
Angular js
Angular js
Mindtree
 
Intoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
Different way to share data between controllers in angular js
Different way to share data between controllers in angular js
codeandyou forums
 
AngularJS: Overview & Key Features
AngularJS: Overview & Key Features
Mohamad Al Asmar
 
AngularJs (1.x) Presentation
AngularJs (1.x) Presentation
Raghubir Singh
 
Live Demo : Trending Angular JS Featues
Live Demo : Trending Angular JS Featues
Edureka!
 
The Basics Angular JS
The Basics Angular JS
OrisysIndia
 
AngularJS interview questions
AngularJS interview questions
Uri Lukach
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 

Viewers also liked (9)

Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
Kalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB Tutorials
Kalp Corporate
 
Advantages of angular js for development
Advantages of angular js for development
VedRaj2015
 
Angular js tutorial slides
Angular js tutorial slides
samhelman
 
Angular JS
Angular JS
John Temoty Roca
 
Why angular js Framework
Why angular js Framework
Sakthi Bro
 
Understanding angular js
Understanding angular js
Aayush Shrestha
 
AngularJS Basics with Example
AngularJS Basics with Example
Sergey Bolshchikov
 
Introduction to Angularjs
Introduction to Angularjs
Manish Shekhawat
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
Kalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB Tutorials
Kalp Corporate
 
Advantages of angular js for development
Advantages of angular js for development
VedRaj2015
 
Angular js tutorial slides
Angular js tutorial slides
samhelman
 
Why angular js Framework
Why angular js Framework
Sakthi Bro
 
Understanding angular js
Understanding angular js
Aayush Shrestha
 
Ad

Similar to Kalp Corporate Angular Js Tutorials (20)

AngularJS By Vipin
AngularJS By Vipin
Vipin Mundayad
 
Introduction to AngularJS By Bharat Makwana
Introduction to AngularJS By Bharat Makwana
Bharat Makwana
 
angularjs_tutorial.docx
angularjs_tutorial.docx
telegramvip
 
Anjular js
Anjular js
Naga Dinesh
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
One Weekend With AngularJS
One Weekend With AngularJS
Yashobanta Bai
 
Angularjs
Angularjs
Sabin Tamrakar
 
AngularJS is awesome
AngularJS is awesome
Eusebiu Schipor
 
Wt unit 5 client &amp; server side framework
Wt unit 5 client &amp; server side framework
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
AngularJS Introduction, how to run Angular
AngularJS Introduction, how to run Angular
SamuelJohnpeter
 
Angularjs basic part01
Angularjs basic part01
Mohd Abdul Baquee
 
Angular JS training institute in Jaipur
Angular JS training institute in Jaipur
HEMANT SAXENA
 
ANGULAR JS TRAINING IN PUNE
ANGULAR JS TRAINING IN PUNE
cncwebworld
 
AngularJs Basic Concept
AngularJs Basic Concept
Hari Haran
 
Angular Javascript Tutorial with command
Angular Javascript Tutorial with command
ssuser42b933
 
Angular js
Angular js
Silver Touch Technologies Ltd
 
AngularJS
AngularJS
Srivatsan Krishnamachari
 
Angular js getting started
Angular js getting started
Hemant Mali
 
AngularJs
AngularJs
Abdhesh Kumar
 
Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01
Arunangsu Sahu
 
Introduction to AngularJS By Bharat Makwana
Introduction to AngularJS By Bharat Makwana
Bharat Makwana
 
angularjs_tutorial.docx
angularjs_tutorial.docx
telegramvip
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
One Weekend With AngularJS
One Weekend With AngularJS
Yashobanta Bai
 
AngularJS Introduction, how to run Angular
AngularJS Introduction, how to run Angular
SamuelJohnpeter
 
Angular JS training institute in Jaipur
Angular JS training institute in Jaipur
HEMANT SAXENA
 
ANGULAR JS TRAINING IN PUNE
ANGULAR JS TRAINING IN PUNE
cncwebworld
 
AngularJs Basic Concept
AngularJs Basic Concept
Hari Haran
 
Angular Javascript Tutorial with command
Angular Javascript Tutorial with command
ssuser42b933
 
Angular js getting started
Angular js getting started
Hemant Mali
 
Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01
Arunangsu Sahu
 
Ad

Recently uploaded (20)

June Patch Tuesday
June Patch Tuesday
Ivanti
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...
Matsushita Laboratory
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...
Matsushita Laboratory
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 

Kalp Corporate Angular Js Tutorials

  • 2. 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.  https://angularjs.org
  • 3. FEATURES  AngularJS is a powerful JavaScript based development framework to create RICH Internet Application(RIA).  AngularJS provides developers options to write client side application (using JavaScript) in a clean MVC(Model View Controller) way.  Application written in AngularJS is cross-browser compliant. AngularJS automatically handles JavaScript code suitable for each browser.  AngularJS is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.0.
  • 4. IMPORTANT PARTS OF ANGULARJS
  • 5. FEATURES  Data-binding − It is the automatic synchronization of data between model and view components.  Scope − These are objects that refer to the model. They act as a glue between controller and view.  Controller − These are JavaScript functions that are bound to a particular scope.  Services − AngularJS come with several built-in services for example $http to make a XMLHttpRequests. These are singleton objects which are instantiated only once in app.  Filters − These select a subset of items from an array and returns a new array.  Directives − Directives are markers on DOM elements (such as elements, attributes, css, and more). These can be used to create custom HTML tags that serve as new, custom widgets. AngularJS has built-in directives (ngBind, ngModel...)  Templates − These are the rendered view with information from the controller and model. These can be a single file (like index.html) or multiple views in one page using "partials".  Routing − It is concept of switching views.
  • 6. FEATURES  Model View controller − MVC is a design pattern for dividing an application into different parts (called Model, View and Controller), each with distinct responsibilities. AngularJS does not implement MVC in the traditional sense, but rather something closer to MVVM (Model-View-ViewModel). The Angular JS team refers it humorously as Model View Whatever.  Dependency Injection − AngularJS has a built-in dependency injection subsystem that helps the developer by making the application easier to develop, understand, and test.
  • 7. ADVANTAGES OF ANGULARJS  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.
  • 8. DISADVANTAGES OF ANGULARJS  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  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. MVC
  • 11. MVC  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.
  • 12. STEPS TO CREATE ANGULARJS APP Step-1  We have included the AngularJS JavaScript file in the HTML page so we can use AngularJS − <script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1 .3.14/angular.min.js"> </script> Step-2  Define AngularJS Application using ng-app directive <body ng-app = "myapp"> </body>
  • 13. STEPS(CONTI..) Step 3  Define a model name using ng-model directive <p>Enter your Name: <input type = "text" ng- model = "name"></p> Step-4 Bind the value of above model defined using ng-bind directive.  <p>Hello <span ng-bind = "name"></span>!</p>
  • 14. HOW ANGULARJS INTEGRATES WITH HTML  ng-app directive indicates the start of AngularJS application.  ng-model directive then creates a model variable named "name" which can be used with the html page and within the div having ng-app directive.  ng-bind uses the name model to be displayed in the html span tag whenever user input something in the text box.  Closing</div> tag indicates the end of AngularJS application
  • 15. USE ABOVE MENTIONED THREE STEPS IN AN HTML PAGE. <html> <head> <title>AngularJS First Application</title> </head> <body> <h1>Sample Application</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 = "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular. min.js"> </script> </body> </html>
  • 17. EXPRESSION  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. AngularJS application expressions are pure javascript expressions and outputs the data where they are used.  <p>Hello {{student.firstname + " " + student.lastname}}!</p>
  • 18. CONTROLLER  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>
  • 19. FILTER  Filters are used to change modify the data and can be clubbed in expression or directives using pipe character. Following is the list of commonly used filters.
  • 20. Sr.No. Name Description 1 uppercase converts a text to upper case text. 2 lowercase converts a text to lower case text. 3 currency formats text in a currency format. 4 filter filter the array to a subset of it based on provided criteria. 5 orderby orders the array based on provided criteria.
  • 21. MODULE  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. In this example we're going to create two modules.  Application Module − used to initialize an application with controller(s). var mainApp = angular.module("mainApp", []);
  • 22. MODULE(CONTI..)  Controller Module − used to define the controller. mainApp.controller("studentController", function($scope) { …… … });
  • 23. AJAX CALL:  AngularJS provides $http control which works as a service to read data from the server. The server makes a database call to get the desired records. AngularJS needs data in JSON format. Once the data is ready, $http can be used to get the data from server
  • 24. $ROUTE  $routeProvider is the key service which set the configuration of urls, map them with the corresponding html page or ng-template, and attach a controller with the same.
  • 25. var mainApp = angular.module("mainApp", ['ngRoute']); mainApp.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/addStudent', { templateUrl: 'addStudent.htm', controller: 'AddStudentController' }). when('/viewStudents', { templateUrl: 'viewStudents.htm', controller: 'ViewStudentsController' }). otherwise({ redirectTo: '/addStudent' }); }]);
  • 27. Our online IM Id’s for more convenient communication. 3, Suvarna Nagar Bungalow, Near St.Xaviers School Loyola, Ahmedabad-380013, Gujarat, India +91 9879518121 +91 757-294-0388 (001) 415 251 KALP kalpcorporate nihar.kalp [email protected] [email protected] [email protected] kalpcorporate.com