SlideShare a Scribd company logo
Angular JS
Brians Section
Part 1 and 2
Slide Show can be found at:
http://www.slideshare.net/BrianAtkins1/intro-to-angular-js
Or
https://docs.google.com/presentation/d/1iCi6rKpyIDw8y0aEtMs
z2ftr4rRIEs0kb19RWFephVw/edit?usp=sharing
Overview of concepts
overview of concepts covered:
ng-app
{{}}
ng-init
ng-model
ng-controller
ng-repeat
ng-click
ng-bind
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.
Example
<ul>
<li ng-repeat="x in names">
{{ x.name + ', ' + x.country }}
</li>
</ul>
AngularJS Filters
AngularJS filters can be used to transform data:
currency Format a number to a currency format.
filter Select a subset of items from an array.
lowercase Format a string to lower case.
orderBy Orders an array by an expression.
uppercase Format a string to upper case.
Currency Filter
Formats a number as a currency (ie $1,234.56). When no
currency symbol is provided, default symbol for current locale is
used.
Example:
<span id="currency-default">{{amount | currency}}</span><br>
<!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.
Example
<p>Number of characters left: <span ng-
bind="left()"></span></p>
Binds this to it.
$scope.left = function () { return 100 - $scope.message.length; };
Final Exercise

More Related Content

PPTX
Angularjs Basics
PPTX
Top 10 Mistakes AngularJS Developers Make
PDF
Angular js - the beginning
PPTX
Angularjs Anti-patterns
PDF
AngularJS Basics with Example
PDF
AngularJS Framework
PPTX
AngularJs
DOCX
Filters in AngularJS
Angularjs Basics
Top 10 Mistakes AngularJS Developers Make
Angular js - the beginning
Angularjs Anti-patterns
AngularJS Basics with Example
AngularJS Framework
AngularJs
Filters in AngularJS

What's hot (20)

ODP
AngularJs Crash Course
PPTX
AngularJS Beginners Workshop
PDF
Advanced Tips & Tricks for using Angular JS
PPTX
Understanding angular js
PDF
AngularJS best-practices
DOCX
Built in filters
DOCX
How to call $scope function from console
PPTX
AngularJS $Provide Service
PPTX
AngularJS Internal
PPTX
AngularJS Architecture
PPTX
Jquery Complete Presentation along with Javascript Basics
PPTX
Practical AngularJS
PPTX
Tips for Angular Applications
PPTX
Upgrading from Angular 1.x to Angular 2.x
PPTX
AngularJS in 60ish Minutes
PPTX
AngularJs presentation
PDF
Integrating Angular js & three.js
PPTX
AngularJs $provide API internals & circular dependency problem.
DOCX
Controller in AngularJS
PPTX
AngularJS Directives
AngularJs Crash Course
AngularJS Beginners Workshop
Advanced Tips & Tricks for using Angular JS
Understanding angular js
AngularJS best-practices
Built in filters
How to call $scope function from console
AngularJS $Provide Service
AngularJS Internal
AngularJS Architecture
Jquery Complete Presentation along with Javascript Basics
Practical AngularJS
Tips for Angular Applications
Upgrading from Angular 1.x to Angular 2.x
AngularJS in 60ish Minutes
AngularJs presentation
Integrating Angular js & three.js
AngularJs $provide API internals & circular dependency problem.
Controller in AngularJS
AngularJS Directives
Ad

Similar to Angular js (20)

PPTX
intro to Angular js
DOCX
Angular js
PDF
Workshop 12: AngularJS Parte I
PPTX
ANGULARJS introduction components services and directives
PDF
Dive into AngularJS and directives
PDF
Wt unit 5 client &amp; server side framework
PPTX
Angular js PPT
PPT
Coffee@DBG - Exploring Angular JS
PDF
AngularJS Basics
PDF
Introduction to AngularJS By Bharat Makwana
PPTX
01 startoff angularjs
PDF
Angularjs
PPTX
Kalp Corporate Angular Js Tutorials
PDF
Introduction to AngularJS
PPTX
Angular js
PPTX
Intoduction to Angularjs
PDF
PPTX
Introduction to AngularJS
PPTX
Angular Javascript Tutorial with command
intro to Angular js
Angular js
Workshop 12: AngularJS Parte I
ANGULARJS introduction components services and directives
Dive into AngularJS and directives
Wt unit 5 client &amp; server side framework
Angular js PPT
Coffee@DBG - Exploring Angular JS
AngularJS Basics
Introduction to AngularJS By Bharat Makwana
01 startoff angularjs
Angularjs
Kalp Corporate Angular Js Tutorials
Introduction to AngularJS
Angular js
Intoduction to Angularjs
Introduction to AngularJS
Angular Javascript Tutorial with command
Ad

Recently uploaded (20)

PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
medical staffing services at VALiNTRY
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
System and Network Administraation Chapter 3
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
System and Network Administration Chapter 2
PPT
Introduction Database Management System for Course Database
PPTX
Transform Your Business with a Software ERP System
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
top salesforce developer skills in 2025.pdf
PDF
Nekopoi APK 2025 free lastest update
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Digital Strategies for Manufacturing Companies
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
medical staffing services at VALiNTRY
How to Migrate SBCGlobal Email to Yahoo Easily
System and Network Administraation Chapter 3
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
System and Network Administration Chapter 2
Introduction Database Management System for Course Database
Transform Your Business with a Software ERP System
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
wealthsignaloriginal-com-DS-text-... (1).pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
top salesforce developer skills in 2025.pdf
Nekopoi APK 2025 free lastest update
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Digital Strategies for Manufacturing Companies
Upgrade and Innovation Strategies for SAP ERP Customers
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle

Angular js

  • 2. Slide Show can be found at: http://www.slideshare.net/BrianAtkins1/intro-to-angular-js Or https://docs.google.com/presentation/d/1iCi6rKpyIDw8y0aEtMs z2ftr4rRIEs0kb19RWFephVw/edit?usp=sharing
  • 3. Overview of concepts overview of concepts covered: ng-app {{}} ng-init ng-model ng-controller ng-repeat ng-click ng-bind
  • 4. Working with angularjs • In order to use Angular I used Visual Studio Nuget Installer to install AngularJS
  • 5. 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>
  • 7. You need to place this tag in the top of your document <script src="Scripts/angular.min.js"></script>
  • 8. 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 {{ }}
  • 9. <!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>
  • 10. The ng-model directive: Binds the value of HTML controls (input, select, textarea) to application data. To initialize a value use ng-init.
  • 11. <!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>
  • 12. $scope In AngularJS, $scope is the application object (the owner of application variables and functions).
  • 13. AngularJS controllers control the data of AngularJS applications. are regular JavaScript Objects.
  • 14. ng-controller The ng-controller directive defines the application controller. A controller is a JavaScript Object, created by a standard JavaScript object constructor.
  • 15. <!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>
  • 16. ng-click The ng-click directive allows you to specify custom behavior when an element is clicked
  • 17. 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. Example <ul> <li ng-repeat="x in names"> {{ x.name + ', ' + x.country }} </li> </ul>
  • 18. AngularJS Filters AngularJS filters can be used to transform data: currency Format a number to a currency format. filter Select a subset of items from an array. lowercase Format a string to lower case. orderBy Orders an array by an expression. uppercase Format a string to upper case.
  • 19. Currency Filter Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used. Example: <span id="currency-default">{{amount | currency}}</span><br>
  • 20. <!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>
  • 21. 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!"); }; });
  • 22. The ng-bind directive: binds application data to the HTML view. Example <p>Number of characters left: <span ng- bind="left()"></span></p> Binds this to it. $scope.left = function () { return 100 - $scope.message.length; };