SlideShare a Scribd company logo
Angular JS
Brians Section
Part 1 and 2
Working with angularjs
• In order to use Angular I used Visual Studio Nuget Installer to
install AngularJS
Google Hosted Libraries
The Google Hosted Libraries is a stable, reliable, high-speed,
globally available content distribution network for the most
popular, open-source JavaScript libraries. To add a library to your
site, simply use <script> tags to include the library.
<script src=
"http://ajax.googleapis.com/ajax/libs/angularjs/1.2
.26/angular.min.js"></script>
https://angularjs.org/
You need to place this tag in the top
of your document
<script src="Scripts/angular.min.js"></script>
AngularJS extends HTML attributes
with Directives, and binds data to
HTML with Expressions.
The ng-app directive:
defines an AngularJS application.
To create an expression use {{ }}
<!DOCTYPE html>
<head>
<title></title>
<script src="Scripts/angular.min.js"></script>
</head>
<body>
<div ng-app="">
<p>My first expression: {{ 5 + 5 }}</p>
</div>
</body>
</html>
The ng-model directive:
Binds the value of HTML controls (input, select, textarea) to
application data.
To initialize a value use ng-init.
<!DOCTYPE html>
<head>
<title></title>
<script src="Scripts/angular.min.js"></script>
</head>
<body>
<div ng-app ng-init="qty=1;cost=2">
<b>Invoice:</b>
<div>
Quantity: <input type="number" ng-model="qty">
</div>
<div>
Costs: <input type="number" ng-model="cost">
</div>
<div>
<b>Total:</b> {{qty * cost | currency}}
</div>
</div>
</body>
</html>
$scope
In AngularJS, $scope is the application object (the owner of
application variables and functions).
AngularJS controllers
control the data of AngularJS applications.
are regular JavaScript Objects.
ng-controller
The ng-controller directive defines the application controller.
A controller is a JavaScript Object, created by a standard
JavaScript object constructor.
<!DOCTYPE html>
<html>
<head>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
</head>
<body>
<div ng-app="" ng-controller="personController">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
Full Name: {{firstName + " " + lastName}}
</div>
<script>
function personController($scope) {
$scope.firstName = "John",
$scope.lastName = "Doe"
}
</script>
</body>
</html>
ng-click
The ng-click directive allows you to specify custom behavior
when an element is clicked
ng-repeat
The ng-repeat directive instantiates a template once per item
from a collection. Each template instance gets its own scope,
where the given loop variable is set to the current collection
item, and $index is set to the item index or key.
<!doctype html>
<head>
<title>Example - example-guide-concepts-2-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script>
<script src="invoice1.js"></script>
</head>
<body >
<div ng-app="invoice1" ng-controller="InvoiceController as invoice">
<b>Invoice:</b>
<div>
Quantity: <input type="number" ng-model="invoice.qty" required >
</div>
<div>
Costs: <input type="number" ng-model="invoice.cost" required >
<select ng-model="invoice.inCurr">
<option ng-repeat="c in invoice.currencies">{{c}}</option>
</select>
</div>
<div>
<b>Total:</b>
<span ng-repeat="c in invoice.currencies">
{{invoice.total(c) | currency:c}}
</span>
<button class="btn" ng-click="invoice.pay()">Pay</button>
</div>
</div>
</body>
</html>
Invoice.js
angular.module('invoice1', [])
.controller('InvoiceController', function () {
this.qty = 1;
this.cost = 2;
this.inCurr = 'EUR';
this.currencies = ['USD', 'EUR', 'CNY'];
this.usdToForeignRates = {
USD: 1,
EUR: 0.74,
CNY: 6.09
};
this.total = function total(outCurr) {
return this.convertCurrency(this.qty * this.cost, this.inCurr, outCurr);
};
this.convertCurrency = function convertCurrency(amount, inCurr, outCurr) {
return amount * this.usdToForeignRates[outCurr] / this.usdToForeignRates[inCurr];
};
this.pay = function pay() {
window.alert("Thanks!");
};
});
The ng-bind directive:
binds application data to the HTML view.

More Related Content

What's hot (20)

DOCX
multiple views and routing
Brajesh Yadav
 
PPTX
Angular js PPT
Imtiyaz Ahmad Khan
 
PDF
The Art of AngularJS - DeRailed 2014
Matt Raible
 
PPTX
Let's react - Meetup
RAJNISH KATHAROTIYA
 
PPTX
Angular js for beginners
Munir Hoque
 
PDF
Angularjs - lazy loading techniques
Nir Kaufman
 
PDF
AngularJS Deep Dives (NYC GDG Apr 2013)
Nitya Narasimhan
 
PDF
AngularJS: an introduction
Luigi De Russis
 
PPTX
Angular js
Dinusha Nandika
 
PDF
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
PDF
Grails Simple Login
moniguna
 
PDF
Dive into AngularJS and directives
Tricode (part of Dept)
 
PDF
Modern Web Application Development Workflow - EclipseCon Europe 2014
Stéphane Bégaudeau
 
PPTX
Angular js
ParmarAnisha
 
PDF
Svelte JS introduction
Mikhail Kuznetcov
 
PPTX
React / Redux Architectures
Vinícius Ribeiro
 
PDF
Introduction to AngularJS
Jussi Pohjolainen
 
PDF
Developing large scale JavaScript applications
Milan Korsos
 
PPTX
AngularJS intro
dizabl
 
PDF
Backbone.js
Omnia Helmi
 
multiple views and routing
Brajesh Yadav
 
Angular js PPT
Imtiyaz Ahmad Khan
 
The Art of AngularJS - DeRailed 2014
Matt Raible
 
Let's react - Meetup
RAJNISH KATHAROTIYA
 
Angular js for beginners
Munir Hoque
 
Angularjs - lazy loading techniques
Nir Kaufman
 
AngularJS Deep Dives (NYC GDG Apr 2013)
Nitya Narasimhan
 
AngularJS: an introduction
Luigi De Russis
 
Angular js
Dinusha Nandika
 
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
Grails Simple Login
moniguna
 
Dive into AngularJS and directives
Tricode (part of Dept)
 
Modern Web Application Development Workflow - EclipseCon Europe 2014
Stéphane Bégaudeau
 
Angular js
ParmarAnisha
 
Svelte JS introduction
Mikhail Kuznetcov
 
React / Redux Architectures
Vinícius Ribeiro
 
Introduction to AngularJS
Jussi Pohjolainen
 
Developing large scale JavaScript applications
Milan Korsos
 
AngularJS intro
dizabl
 
Backbone.js
Omnia Helmi
 

Similar to intro to Angular js (20)

PPTX
Custom directive and scopes
jagriti srivastava
 
PPTX
Angular js
Brian Atkins
 
PDF
Course CodeSchool - Shaping up with Angular.js
Vinícius de Moraes
 
PPTX
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
Learnimtactics
 
PPT
AngularJS Mobile Warsaw 20-10-2014
Dariusz Kalbarczyk
 
PPTX
AgularJS basics- angular directives and controllers
jobinThomas54
 
DOCX
Sharing Data between controllers in different ways.
Amar Shukla
 
DOCX
Different way to share data between controllers in angular js
codeandyou forums
 
DOCX
Angular js
prasaddammalapati
 
PDF
243329387 angular-docs
Abhi166803
 
PDF
Angular js
Eueung Mulyana
 
PPTX
AngularJS Introduction, how to run Angular
SamuelJohnpeter
 
PPTX
Basics of AngularJS
Filip Janevski
 
PPTX
lec 14-15 Jquery_All About J-query_.pptx
MuhammadAbubakar114879
 
PPTX
Angular - Beginner
Riccardo Masetti
 
PPTX
Angular js
Steve Fort
 
PPTX
SharePoint Saturday Atlanta 2015
Pushkar Chivate
 
PPTX
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
PPT
AngularJS for Legacy Apps
Peter Drinnan
 
PDF
Introduction of angular js
Tamer Solieman
 
Custom directive and scopes
jagriti srivastava
 
Angular js
Brian Atkins
 
Course CodeSchool - Shaping up with Angular.js
Vinícius de Moraes
 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
Learnimtactics
 
AngularJS Mobile Warsaw 20-10-2014
Dariusz Kalbarczyk
 
AgularJS basics- angular directives and controllers
jobinThomas54
 
Sharing Data between controllers in different ways.
Amar Shukla
 
Different way to share data between controllers in angular js
codeandyou forums
 
Angular js
prasaddammalapati
 
243329387 angular-docs
Abhi166803
 
Angular js
Eueung Mulyana
 
AngularJS Introduction, how to run Angular
SamuelJohnpeter
 
Basics of AngularJS
Filip Janevski
 
lec 14-15 Jquery_All About J-query_.pptx
MuhammadAbubakar114879
 
Angular - Beginner
Riccardo Masetti
 
Angular js
Steve Fort
 
SharePoint Saturday Atlanta 2015
Pushkar Chivate
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
AngularJS for Legacy Apps
Peter Drinnan
 
Introduction of angular js
Tamer Solieman
 
Ad

Recently uploaded (20)

PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Ad

intro to Angular js

  • 2. Working with angularjs • In order to use Angular I used Visual Studio Nuget Installer to install AngularJS
  • 3. Google Hosted Libraries The Google Hosted Libraries is a stable, reliable, high-speed, globally available content distribution network for the most popular, open-source JavaScript libraries. To add a library to your site, simply use <script> tags to include the library. <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2 .26/angular.min.js"></script>
  • 5. You need to place this tag in the top of your document <script src="Scripts/angular.min.js"></script>
  • 6. AngularJS extends HTML attributes with Directives, and binds data to HTML with Expressions. The ng-app directive: defines an AngularJS application. To create an expression use {{ }}
  • 7. <!DOCTYPE html> <head> <title></title> <script src="Scripts/angular.min.js"></script> </head> <body> <div ng-app=""> <p>My first expression: {{ 5 + 5 }}</p> </div> </body> </html>
  • 8. The ng-model directive: Binds the value of HTML controls (input, select, textarea) to application data. To initialize a value use ng-init.
  • 9. <!DOCTYPE html> <head> <title></title> <script src="Scripts/angular.min.js"></script> </head> <body> <div ng-app ng-init="qty=1;cost=2"> <b>Invoice:</b> <div> Quantity: <input type="number" ng-model="qty"> </div> <div> Costs: <input type="number" ng-model="cost"> </div> <div> <b>Total:</b> {{qty * cost | currency}} </div> </div> </body> </html>
  • 10. $scope In AngularJS, $scope is the application object (the owner of application variables and functions).
  • 11. AngularJS controllers control the data of AngularJS applications. are regular JavaScript Objects.
  • 12. ng-controller The ng-controller directive defines the application controller. A controller is a JavaScript Object, created by a standard JavaScript object constructor.
  • 13. <!DOCTYPE html> <html> <head> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> </head> <body> <div ng-app="" ng-controller="personController"> First Name: <input type="text" ng-model="firstName"><br> Last Name: <input type="text" ng-model="lastName"><br> <br> Full Name: {{firstName + " " + lastName}} </div> <script> function personController($scope) { $scope.firstName = "John", $scope.lastName = "Doe" } </script> </body> </html>
  • 14. ng-click The ng-click directive allows you to specify custom behavior when an element is clicked
  • 15. ng-repeat The ng-repeat directive instantiates a template once per item from a collection. Each template instance gets its own scope, where the given loop variable is set to the current collection item, and $index is set to the item index or key.
  • 16. <!doctype html> <head> <title>Example - example-guide-concepts-2-production</title> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script> <script src="invoice1.js"></script> </head> <body > <div ng-app="invoice1" ng-controller="InvoiceController as invoice"> <b>Invoice:</b> <div> Quantity: <input type="number" ng-model="invoice.qty" required > </div> <div> Costs: <input type="number" ng-model="invoice.cost" required > <select ng-model="invoice.inCurr"> <option ng-repeat="c in invoice.currencies">{{c}}</option> </select> </div> <div> <b>Total:</b> <span ng-repeat="c in invoice.currencies"> {{invoice.total(c) | currency:c}} </span> <button class="btn" ng-click="invoice.pay()">Pay</button> </div> </div> </body> </html>
  • 17. Invoice.js angular.module('invoice1', []) .controller('InvoiceController', function () { this.qty = 1; this.cost = 2; this.inCurr = 'EUR'; this.currencies = ['USD', 'EUR', 'CNY']; this.usdToForeignRates = { USD: 1, EUR: 0.74, CNY: 6.09 }; this.total = function total(outCurr) { return this.convertCurrency(this.qty * this.cost, this.inCurr, outCurr); }; this.convertCurrency = function convertCurrency(amount, inCurr, outCurr) { return amount * this.usdToForeignRates[outCurr] / this.usdToForeignRates[inCurr]; }; this.pay = function pay() { window.alert("Thanks!"); }; });
  • 18. The ng-bind directive: binds application data to the HTML view.