SlideShare a Scribd company logo
AngularJS
What’s the Big Deal?
Jim Duffy
TakeNote Technologies
© 2015 TakeNote Technologies
All Rights Reserved
Who Am I?
 Jim Duffy jduffy@takenote.com
 CEO/Founder TakeNote Technologies www.takenote.com
 Blog: www.geekswithblogs.net/takenote/
 Twitter: @jmduffy
 Microsoft Regional Director www.msrd.io
 11 time Microsoft Most Valuable Professional (MVP)
 .NET, ASP.NET, HTML5, JavaScript, AngularJS & SQL Server
Instructor, Mentor, Developer, and Consultant
 Experienced conference presenter
 Contributor to CODE Magazine
© 2015 TakeNote Technologies
All Rights Reserved
Microsoft Regional Director
© 2015 TakeNote Technologies
All Rights Reserved
“I am appointed by Microsoft with an independent external role in
the Regional Director program, as one of the top 130 advocates
worldwide for Microsoft, being recognized for deep and broad
technical expertise in many technologies, public communications,
community leadership and corporate experience, while maintaining
a privileged two-way relationship and communication channel with
the regional office, product teams, and senior Microsoft HQ
personnel.”
tl; dr: Microsoft values and trusts me. I am here to help you and
your organization.
The Plan For This Session
 What is AngularJS
 Why Use AngularJS
 AngularJS Overview
 Definitions
 Code Demos
© 2015 TakeNote Technologies
All Rights Reserved
What Is AngularJS
 Framework used primarily for building
Single Page Applications
 Written in JavaScript
 Developed and supported by Google
© 2014 TakeNote Technologies
All Rights Reserved
Why Use AngularJS?
 It’s modular
 It provides powerful two-way data
binding
 It uses expressive HTML via directives
 It is designed to be testable
 Built in route navigation
 Because its popular
© 2014 TakeNote Technologies
All Rights Reserved
AngularJS At 30,000 Feet
© 2014 TakeNote Technologies
All Rights Reserved
Directives & Data Binding
 ng-app: defines the module
 One-way data binding
 ng-bind
 {{ Lastname }} syntax more
common
 Two-way data binding
 ng-model="Lastname"
© 2014 TakeNote Technologies
All Rights Reserved
Directives & Data Binding
© 2014 TakeNote Technologies
All Rights Reserved
<div>
<label for="Lastname">Last Name:</label>
<input type="text"
name="Lastname"
ng-model="vm.Lastname" />
</div>
<div>
<label for="Firstname">First Name:</label>
<input type="text"
name=“Firstname"
ng-model="vm.Firstname" />
</div>
Directives & Data Binding
© 2014 TakeNote Technologies
All Rights Reserved
DEMO 1
Modules
 Modules define and contain the
application
© 2014 TakeNote Technologies
All Rights Reserved
Creating A Module In app.js
© 2014 TakeNote Technologies
All Rights Reserved
// app.js
(function () {
"use strict";
var app = angular.module("collegesApp", []);
}());
 Using the angular.module function
 Use immediately invoked function
expression (iife)
Modules
© 2014 TakeNote Technologies
All Rights Reserved
DEMO 2
Views
© 2014 TakeNote Technologies
All Rights Reserved
Applying Module To A View
© 2014 TakeNote Technologies
All Rights Reserved
<html ng-app="collegesApp">
<head>
…
<script src="scripts/angular.js"></script>
<script src="app/app.js"></script>
</head>
 Using the ng-app directive
Apply Module To A View
© 2014 TakeNote Technologies
All Rights Reserved
DEMO 3
Controllers
© 2014 TakeNote Technologies
All Rights Reserved
Controller Code
© 2014 TakeNote Technologies
All Rights Reserved
// collegesCtrl.js
(function () {
"use strict";
angular.module("collegesApp")
.controller("CollegesCtrl", CollegesCtrl);
function CollegesCtrl ()
{
var vm = this;
var propertyOne = "One";
var propertyTwo = 2;
}
}());
Wire Up A Controller In A View
© 2014 TakeNote Technologies
All Rights Reserved
<head>
<title>Colleges</title>
…
<script src="app/collegesCtrl.js"></script>
</head>
<body ng-controller="CollegesCtrl as cc">
<div class="page-header">
<h1>{{ cc.propertyOne }}'s Colleges</h1>
</div>
…
 Using the ng-controller directive
Controller Best Practices
 Simple is best…place each controller in
it’s own .js file
 Wrap controller in an immediately
invoked function expression(iife)
 Use either Controller or Ctrl as the name
suffix (ex: ProductsCtrl or
ProductsController) – Be Consistent
 Use Pascal case when naming controller
(ex: MyCoolController) – Be Consistent
© 2014 TakeNote Technologies
All Rights Reserved
Controllers
© 2014 TakeNote Technologies
All Rights Reserved
DEMO 4
Defining A Data Model
© 2014 TakeNote Technologies
All Rights Reserved
function CollegesCtrl ()
{
…
vm.colleges = {
conference: "ACC",
items: [{ university: "University of Miami",
city: "Coral Gables",
founder: false },
{ university: "North Carolina",
city: "Chapel Hill",
founder: true }]
};
…
Iterating Through Data
© 2014 TakeNote Technologies
All Rights Reserved
<tbody>
<tr ng-repeat="college in cc.colleges.items">
<td>{{ college.name }}</td>
<td>{{ college.city }}</td>
<td>{{ college.founder }}</td>
</tr>
</tbody>
 Using the ng-repeat directive
Defining A Data Model
© 2014 TakeNote Technologies
All Rights Reserved
DEMO 5
Expressions
 JavaScript-like code snippets used in
bindings such as {{ expression }}
 Examples
 1+2={{1+2}}
 user.name
© 2014 TakeNote Technologies
All Rights Reserved
<span> 1+2={{ 1+2 }} </span>
<span class="label label-default">
{{cc.colleges.items.length}}
</span>
Filters
 Filters are implemented with |
© 2014 TakeNote Technologies
All Rights Reserved
<tr ng-repeat="college in cc.colleges.items |
orderBy: 'name' | filter: 'State' ">
<td>{{ college.name | uppercase }}</td>
<td>{{ college.city | lowercase }}</td>
Expressions & Filters
© 2014 TakeNote Technologies
All Rights Reserved
DEMO 6
Events
 Using the ng-click event
© 2014 TakeNote Technologies
All Rights Reserved
<div class="input-group">
<input class="form-control"
ng-model="cc.collegename" />
<span class="input-group-btn">
<button type="button"
class="btn btn-primary"
ng-click="cc.addCollege()">Add</button>
</span>
</div>
Events
© 2014 TakeNote Technologies
All Rights Reserved
DEMO 7
Routes
 Routes are the key to single-page
applications (SPA)
 Routes determine which page will be
displayed in the host page
 Routes are used to bind the controller
to the view
 Routes require use of additional
angular-route.js file
© 2014 TakeNote Technologies
All Rights Reserved
© 2014 TakeNote Technologies
All Rights Reserved
//app.js
var app = angular.module('collegesApp', ['ngRoute']);
app.config(function ($routeProvider) {
$routeProvider.when('/',
{
templateUrl: '/partials/colleges.html',
controller: 'CollegesCtrl',
controllerAs: 'cc'
});
$routeProvider.when('/colleges',
{
templateUrl: '/partials/colleges.html',
controller: 'CollegesCtrl', controllerAs: 'cc'
});
$routeProvider.when('/dataentry',
{
templateUrl: '/partials/dataentry.html',
controller: 'DataEntryCtrl', controllerAs: 'cc'
});
$routeProvider.otherwise({ redirectTo: '/' });
});
Routes
© 2014 TakeNote Technologies
All Rights Reserved
DEMO 8
Data Entry Forms
 Visibility attributes
 ng-show: Displays an element
 ng-hide: Hides an element
 Data validation attributes
 ng-minlength: min string length
 ng-maxlength: max string length
 ng-pattern: regex comparison
© 2014 TakeNote Technologies
All Rights Reserved
Data Entry Forms
 Properties
 $pristine
 $dirty
 $valid
 $invalid
 $touched
 $untouched
 $error
© 2014 TakeNote Technologies
All Rights Reserved
Data Entry Forms
© 2014 TakeNote Technologies
All Rights Reserved
<div class="form-group">
<label for="firstname">First Name:</label>
<input type="text" name="firstname" autofocus required
placeholder="Enter first name"
ng-model="firstname" ng-minlength="2"
ng-maxlength="20" ng-pattern="/^[a-z]+$/"
class="form-control" />
<div class="error-container"
ng-show="myForm.firstname.$dirty &&
myForm.firstname.$invalid">
<small class="error"
ng-show="myForm.firstname.$error.required">
First name is required.</small>
<small class="error"
ng-show="myForm.firstname.$error.minlength">
First name requires at least 2 char.</small>
<small class="error "
ng-show="myForm.firstname.$error.maxlength">
First Name cannot exceed 20 chars.</small>
</div>
</div>
Data Entry Forms - CSS
 ng-pristine: Elements the user has
not interacted are added to this class.
 ng-dirty: Elements the user has
interacted with are added to this class.
 ng-valid: Elements that are valid are
in this class.
 ng-invalid: Elements that are not
valid are in this class.
© 2014 TakeNote Technologies
All Rights Reserved
Data Entry Forms – CSS
© 2014 TakeNote Technologies
All Rights Reserved
form .ng-pristine {
background-color: #fffeb9;
}
form .ng-valid.ng-dirty {
background-color: lightgreen;
}
form .ng-invalid.ng-dirty {
background-color: #ff0000;
}
Data Validation
© 2015 TakeNote Technologies
All Rights Reserved
DEMO 9
Resources
 https://www.angularjs.org/
 https://github.com/angular/angular.js
 https://docs.angularjs.org/guide
 https://blog.angularjs.org/
 https://angularjs.zeef.com/gianluca.arbezzano
 www.takenote.com
Hands On Training Classes from TakeNote
Technologies
- AngularJS Fundamentals (2 days)
- Developing Line of Business Applications With
AngularJS (2 days)
© 2015 TakeNote Technologies
All Rights Reserved
Thank You for Attending!
 My contact info:
Jim Duffy
jduffy@takenote.com
CEO/Founder
TakeNote Technologies
www.takenote.com
Twitter: @jmduffy
© 2015 TakeNote Technologies
All Rights Reserved
TakeNote Technologies
© 2015 TakeNote Technologies
All Rights Reserved
Training Division
 Provides public and on-
site developer training
classes and mentoring
in:
 C#
 ASP.NET MVC
 SQL Server
 HTML5
 JavaScript
 AngularJS
 GrapeCity ActiveReports
Consulting Division
 Develops new web and mobile
solutions
 Develops cloud-based solutions
and migrate existing solutions
to the cloud
 Convert legacy solutions into
modern web & mobile solutions
 Manages new or existing
projects
 Supplements your development
team

More Related Content

Similar to AngularJS: What's the Big Deal?

AngularJS Fundamentals: Date Entry Forms
AngularJS Fundamentals: Date Entry FormsAngularJS Fundamentals: Date Entry Forms
AngularJS Fundamentals: Date Entry Forms
Jim Duffy
 
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Eric D. Boyd
 
Going web native
Going web nativeGoing web native
Going web native
Marcus Hellberg
 
Embedded UA 101 - STC Summit 2013, Scott DeLoach, ClickStart
Embedded UA 101 - STC Summit 2013, Scott DeLoach, ClickStartEmbedded UA 101 - STC Summit 2013, Scott DeLoach, ClickStart
Embedded UA 101 - STC Summit 2013, Scott DeLoach, ClickStart
Scott DeLoach
 
Fundaments of Knockout js
Fundaments of Knockout jsFundaments of Knockout js
Fundaments of Knockout js
Flavius-Radu Demian
 
AngularJS On-Ramp
AngularJS On-RampAngularJS On-Ramp
AngularJS On-Ramp
Mark Freedman
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletonGeorge Nguyen
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
gDayX - Advanced angularjs
gDayX - Advanced angularjsgDayX - Advanced angularjs
gDayX - Advanced angularjsgdgvietnam
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
Visual Engineering
 
SoCraTes 2014: Testing Rich-Web-UI
SoCraTes 2014: Testing Rich-Web-UISoCraTes 2014: Testing Rich-Web-UI
SoCraTes 2014: Testing Rich-Web-UI
Mark Michaelis
 
Introduccion a HTML5
Introduccion a HTML5Introduccion a HTML5
Introduccion a HTML5
Pablo Garaizar
 
html5
html5html5
Mstr meetup
Mstr meetupMstr meetup
Mstr meetup
Bhavani Akunuri
 
Software Quality - A perspective
Software Quality - A perspectiveSoftware Quality - A perspective
Software Quality - A perspective
Thomas P Thomas
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with Stripes
Samuel Santos
 
Lessons learned from upgrading Thymeleaf
Lessons learned from upgrading ThymeleafLessons learned from upgrading Thymeleaf
Lessons learned from upgrading Thymeleaf
VMware Tanzu
 
Introduction to AngularJs
Introduction to AngularJsIntroduction to AngularJs
Introduction to AngularJs
murtazahaveliwala
 

Similar to AngularJS: What's the Big Deal? (20)

AngularJS Fundamentals: Date Entry Forms
AngularJS Fundamentals: Date Entry FormsAngularJS Fundamentals: Date Entry Forms
AngularJS Fundamentals: Date Entry Forms
 
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
 
Going web native
Going web nativeGoing web native
Going web native
 
Embedded UA 101 - STC Summit 2013, Scott DeLoach, ClickStart
Embedded UA 101 - STC Summit 2013, Scott DeLoach, ClickStartEmbedded UA 101 - STC Summit 2013, Scott DeLoach, ClickStart
Embedded UA 101 - STC Summit 2013, Scott DeLoach, ClickStart
 
Fundaments of Knockout js
Fundaments of Knockout jsFundaments of Knockout js
Fundaments of Knockout js
 
AngularJS On-Ramp
AngularJS On-RampAngularJS On-Ramp
AngularJS On-Ramp
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
 
gDayX - Advanced angularjs
gDayX - Advanced angularjsgDayX - Advanced angularjs
gDayX - Advanced angularjs
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
 
SoCraTes 2014: Testing Rich-Web-UI
SoCraTes 2014: Testing Rich-Web-UISoCraTes 2014: Testing Rich-Web-UI
SoCraTes 2014: Testing Rich-Web-UI
 
Resume
ResumeResume
Resume
 
chandan1
chandan1chandan1
chandan1
 
Introduccion a HTML5
Introduccion a HTML5Introduccion a HTML5
Introduccion a HTML5
 
html5
html5html5
html5
 
Mstr meetup
Mstr meetupMstr meetup
Mstr meetup
 
Software Quality - A perspective
Software Quality - A perspectiveSoftware Quality - A perspective
Software Quality - A perspective
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with Stripes
 
Lessons learned from upgrading Thymeleaf
Lessons learned from upgrading ThymeleafLessons learned from upgrading Thymeleaf
Lessons learned from upgrading Thymeleaf
 
Introduction to AngularJs
Introduction to AngularJsIntroduction to AngularJs
Introduction to AngularJs
 

Recently uploaded

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 

AngularJS: What's the Big Deal?

  • 1. AngularJS What’s the Big Deal? Jim Duffy TakeNote Technologies © 2015 TakeNote Technologies All Rights Reserved
  • 2. Who Am I?  Jim Duffy jduffy@takenote.com  CEO/Founder TakeNote Technologies www.takenote.com  Blog: www.geekswithblogs.net/takenote/  Twitter: @jmduffy  Microsoft Regional Director www.msrd.io  11 time Microsoft Most Valuable Professional (MVP)  .NET, ASP.NET, HTML5, JavaScript, AngularJS & SQL Server Instructor, Mentor, Developer, and Consultant  Experienced conference presenter  Contributor to CODE Magazine © 2015 TakeNote Technologies All Rights Reserved
  • 3. Microsoft Regional Director © 2015 TakeNote Technologies All Rights Reserved “I am appointed by Microsoft with an independent external role in the Regional Director program, as one of the top 130 advocates worldwide for Microsoft, being recognized for deep and broad technical expertise in many technologies, public communications, community leadership and corporate experience, while maintaining a privileged two-way relationship and communication channel with the regional office, product teams, and senior Microsoft HQ personnel.” tl; dr: Microsoft values and trusts me. I am here to help you and your organization.
  • 4. The Plan For This Session  What is AngularJS  Why Use AngularJS  AngularJS Overview  Definitions  Code Demos © 2015 TakeNote Technologies All Rights Reserved
  • 5. What Is AngularJS  Framework used primarily for building Single Page Applications  Written in JavaScript  Developed and supported by Google © 2014 TakeNote Technologies All Rights Reserved
  • 6. Why Use AngularJS?  It’s modular  It provides powerful two-way data binding  It uses expressive HTML via directives  It is designed to be testable  Built in route navigation  Because its popular © 2014 TakeNote Technologies All Rights Reserved
  • 7. AngularJS At 30,000 Feet © 2014 TakeNote Technologies All Rights Reserved
  • 8. Directives & Data Binding  ng-app: defines the module  One-way data binding  ng-bind  {{ Lastname }} syntax more common  Two-way data binding  ng-model="Lastname" © 2014 TakeNote Technologies All Rights Reserved
  • 9. Directives & Data Binding © 2014 TakeNote Technologies All Rights Reserved <div> <label for="Lastname">Last Name:</label> <input type="text" name="Lastname" ng-model="vm.Lastname" /> </div> <div> <label for="Firstname">First Name:</label> <input type="text" name=“Firstname" ng-model="vm.Firstname" /> </div>
  • 10. Directives & Data Binding © 2014 TakeNote Technologies All Rights Reserved DEMO 1
  • 11. Modules  Modules define and contain the application © 2014 TakeNote Technologies All Rights Reserved
  • 12. Creating A Module In app.js © 2014 TakeNote Technologies All Rights Reserved // app.js (function () { "use strict"; var app = angular.module("collegesApp", []); }());  Using the angular.module function  Use immediately invoked function expression (iife)
  • 13. Modules © 2014 TakeNote Technologies All Rights Reserved DEMO 2
  • 14. Views © 2014 TakeNote Technologies All Rights Reserved
  • 15. Applying Module To A View © 2014 TakeNote Technologies All Rights Reserved <html ng-app="collegesApp"> <head> … <script src="scripts/angular.js"></script> <script src="app/app.js"></script> </head>  Using the ng-app directive
  • 16. Apply Module To A View © 2014 TakeNote Technologies All Rights Reserved DEMO 3
  • 17. Controllers © 2014 TakeNote Technologies All Rights Reserved
  • 18. Controller Code © 2014 TakeNote Technologies All Rights Reserved // collegesCtrl.js (function () { "use strict"; angular.module("collegesApp") .controller("CollegesCtrl", CollegesCtrl); function CollegesCtrl () { var vm = this; var propertyOne = "One"; var propertyTwo = 2; } }());
  • 19. Wire Up A Controller In A View © 2014 TakeNote Technologies All Rights Reserved <head> <title>Colleges</title> … <script src="app/collegesCtrl.js"></script> </head> <body ng-controller="CollegesCtrl as cc"> <div class="page-header"> <h1>{{ cc.propertyOne }}'s Colleges</h1> </div> …  Using the ng-controller directive
  • 20. Controller Best Practices  Simple is best…place each controller in it’s own .js file  Wrap controller in an immediately invoked function expression(iife)  Use either Controller or Ctrl as the name suffix (ex: ProductsCtrl or ProductsController) – Be Consistent  Use Pascal case when naming controller (ex: MyCoolController) – Be Consistent © 2014 TakeNote Technologies All Rights Reserved
  • 21. Controllers © 2014 TakeNote Technologies All Rights Reserved DEMO 4
  • 22. Defining A Data Model © 2014 TakeNote Technologies All Rights Reserved function CollegesCtrl () { … vm.colleges = { conference: "ACC", items: [{ university: "University of Miami", city: "Coral Gables", founder: false }, { university: "North Carolina", city: "Chapel Hill", founder: true }] }; …
  • 23. Iterating Through Data © 2014 TakeNote Technologies All Rights Reserved <tbody> <tr ng-repeat="college in cc.colleges.items"> <td>{{ college.name }}</td> <td>{{ college.city }}</td> <td>{{ college.founder }}</td> </tr> </tbody>  Using the ng-repeat directive
  • 24. Defining A Data Model © 2014 TakeNote Technologies All Rights Reserved DEMO 5
  • 25. Expressions  JavaScript-like code snippets used in bindings such as {{ expression }}  Examples  1+2={{1+2}}  user.name © 2014 TakeNote Technologies All Rights Reserved <span> 1+2={{ 1+2 }} </span> <span class="label label-default"> {{cc.colleges.items.length}} </span>
  • 26. Filters  Filters are implemented with | © 2014 TakeNote Technologies All Rights Reserved <tr ng-repeat="college in cc.colleges.items | orderBy: 'name' | filter: 'State' "> <td>{{ college.name | uppercase }}</td> <td>{{ college.city | lowercase }}</td>
  • 27. Expressions & Filters © 2014 TakeNote Technologies All Rights Reserved DEMO 6
  • 28. Events  Using the ng-click event © 2014 TakeNote Technologies All Rights Reserved <div class="input-group"> <input class="form-control" ng-model="cc.collegename" /> <span class="input-group-btn"> <button type="button" class="btn btn-primary" ng-click="cc.addCollege()">Add</button> </span> </div>
  • 29. Events © 2014 TakeNote Technologies All Rights Reserved DEMO 7
  • 30. Routes  Routes are the key to single-page applications (SPA)  Routes determine which page will be displayed in the host page  Routes are used to bind the controller to the view  Routes require use of additional angular-route.js file © 2014 TakeNote Technologies All Rights Reserved
  • 31. © 2014 TakeNote Technologies All Rights Reserved //app.js var app = angular.module('collegesApp', ['ngRoute']); app.config(function ($routeProvider) { $routeProvider.when('/', { templateUrl: '/partials/colleges.html', controller: 'CollegesCtrl', controllerAs: 'cc' }); $routeProvider.when('/colleges', { templateUrl: '/partials/colleges.html', controller: 'CollegesCtrl', controllerAs: 'cc' }); $routeProvider.when('/dataentry', { templateUrl: '/partials/dataentry.html', controller: 'DataEntryCtrl', controllerAs: 'cc' }); $routeProvider.otherwise({ redirectTo: '/' }); });
  • 32. Routes © 2014 TakeNote Technologies All Rights Reserved DEMO 8
  • 33. Data Entry Forms  Visibility attributes  ng-show: Displays an element  ng-hide: Hides an element  Data validation attributes  ng-minlength: min string length  ng-maxlength: max string length  ng-pattern: regex comparison © 2014 TakeNote Technologies All Rights Reserved
  • 34. Data Entry Forms  Properties  $pristine  $dirty  $valid  $invalid  $touched  $untouched  $error © 2014 TakeNote Technologies All Rights Reserved
  • 35. Data Entry Forms © 2014 TakeNote Technologies All Rights Reserved <div class="form-group"> <label for="firstname">First Name:</label> <input type="text" name="firstname" autofocus required placeholder="Enter first name" ng-model="firstname" ng-minlength="2" ng-maxlength="20" ng-pattern="/^[a-z]+$/" class="form-control" /> <div class="error-container" ng-show="myForm.firstname.$dirty && myForm.firstname.$invalid"> <small class="error" ng-show="myForm.firstname.$error.required"> First name is required.</small> <small class="error" ng-show="myForm.firstname.$error.minlength"> First name requires at least 2 char.</small> <small class="error " ng-show="myForm.firstname.$error.maxlength"> First Name cannot exceed 20 chars.</small> </div> </div>
  • 36. Data Entry Forms - CSS  ng-pristine: Elements the user has not interacted are added to this class.  ng-dirty: Elements the user has interacted with are added to this class.  ng-valid: Elements that are valid are in this class.  ng-invalid: Elements that are not valid are in this class. © 2014 TakeNote Technologies All Rights Reserved
  • 37. Data Entry Forms – CSS © 2014 TakeNote Technologies All Rights Reserved form .ng-pristine { background-color: #fffeb9; } form .ng-valid.ng-dirty { background-color: lightgreen; } form .ng-invalid.ng-dirty { background-color: #ff0000; }
  • 38. Data Validation © 2015 TakeNote Technologies All Rights Reserved DEMO 9
  • 39. Resources  https://www.angularjs.org/  https://github.com/angular/angular.js  https://docs.angularjs.org/guide  https://blog.angularjs.org/  https://angularjs.zeef.com/gianluca.arbezzano  www.takenote.com Hands On Training Classes from TakeNote Technologies - AngularJS Fundamentals (2 days) - Developing Line of Business Applications With AngularJS (2 days) © 2015 TakeNote Technologies All Rights Reserved
  • 40. Thank You for Attending!  My contact info: Jim Duffy jduffy@takenote.com CEO/Founder TakeNote Technologies www.takenote.com Twitter: @jmduffy © 2015 TakeNote Technologies All Rights Reserved
  • 41. TakeNote Technologies © 2015 TakeNote Technologies All Rights Reserved Training Division  Provides public and on- site developer training classes and mentoring in:  C#  ASP.NET MVC  SQL Server  HTML5  JavaScript  AngularJS  GrapeCity ActiveReports Consulting Division  Develops new web and mobile solutions  Develops cloud-based solutions and migrate existing solutions to the cloud  Convert legacy solutions into modern web & mobile solutions  Manages new or existing projects  Supplements your development team