Академический Документы
Профессиональный Документы
Культура Документы
JavaScript library
Workshop Schedule
1. Presentation
2. Live Coding Examples
3. Practicing AngularJS
AngularJS Facts
Also called just Angular Website: angularjs.org
Initially published in
2009
Released under MIT
Licence
Developed by Google
and community
AngularJS Buzzwords
Two-
Modules
way D
s
e
v
i
ect
Dir
ection
nj
I
y
c
n
de
n
e
p
e
D
Providers
Expressions
Scopes
Services
ata B
indin
llers
o
r
t
Con
Filters
s
e
i
r
o
t
Fac
Valid
ator
app/
css/
js/
index.html
AngularJS Buzzwords
Two-
Modules
way D
s
e
v
i
ect
Dir
ection
nj
I
y
c
n
de
n
e
p
e
D
Providers
Expressions
Scopes
Services
ata B
indin
llers
o
r
t
Con
Filters
s
e
i
r
o
t
Fac
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
v
i
t
on
i
c
t
c
e
e
ers
j
l
r
l
n
i
I
o
r
y
t
D
nc
e
Con
d
n
e
Dep
Scopes
Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
Directives (1/7)
What the $%&!% are directives?!
Elements (<ng-include></ng-include)
Classes (class="ng-include: data;")
Attributes (<b ng-include="data">)
Comments (<!-- directive: ng-include data -->)
Directives (2/7)
AngularJS provided directives
ngClass
ngRepeat
ngBind
ngClick
ngShow
ngBlur
ngInlcude
ngSrc
ngChange
ngModel
...
ngChecked
ngPluralize
20th June 2014, Armin Rdiger Vieweg (@ArminVieweg)
Getting started with superheroic JavaScript library AngularJS
Directives (3/7)
Different syntax available
Directive ngModel:
<input
<input
<input
<input
<input
<input
ng-model="foo">
data-ng:model="foo">
data-ng-model="foo">
ng:model="foo">
ng_model="foo">
x-ng-model="foo">
Directives (4/7)
Simple example of Angulars directives (1/2)
Directives (5/7)
Simple example of Angulars directives (2/2)
Directives (6/7)
Summary
Directives (7/7)
Result
A dynamic application
without writing one line of
javascript code
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
v
i
t
on
i
c
t
c
e
e
ers
j
l
r
l
n
i
I
o
r
y
t
D
nc
e
Con
d
n
e
Dep
Scopes
Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
v
i
t
on
i
c
t
c
e
e
ers
j
l
r
l
n
i
I
o
r
y
t
D
nc
e
Con
d
n
e
Dep
Scopes
Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
1. Scopes
2. Controllers
3. Expressions
4. Two-Way Data Binding
$rootScope
<body ng-app="myFirstApp">
<input type="text" ng-model="name">
<button ng-click="name='Penelope'">Click me</button>
<div ng-controller="SuperheroicController">
<h1 ng-show="name" ng-class="{red: name=='Armin'}">
Hello, {{name}}!
</h1>
</div>
<!-- ... -->
</body>
scope
Examples:
a.
b.
c.
d.
e.
{{a+b}}
{{alert('Does this work?')}}
{{'Just outputs this string'}}
{{a ? a : '??'}}
{{user.name}}
20th June 2014, Armin Rdiger Vieweg (@ArminVieweg)
Getting started with superheroic JavaScript library AngularJS
Model User
{
id: 1,
name: 'Vieweg',
firstName: 'Armin',
image: 'armin.png'
}
<div class="user">
<img ng-src="path/to/{{user.image}}">
<h2>
{{user.name}},
{{user.firstName}}
</h2>
</div>
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
v
i
t
on
i
c
t
c
e
e
ers
j
l
r
l
n
i
I
o
r
y
t
D
nc
e
Con
d
n
e
Dep
Scopes
Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
v
i
t
on
i
c
t
c
e
e
ers
j
l
r
l
n
i
I
o
r
y
t
D
nc
e
Con
d
n
e
Dep
Scopes Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
v
i
t
on
i
c
t
c
e
e
ers
j
l
r
l
n
i
I
o
r
y
t
D
nc
e
Con
d
n
e
Dep
Scopes Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
v
i
t
on
i
c
t
c
rs
e
e
e
j
l
r
l
n
i
I
o
cy
D
n
ontr
e
C
d
n
Depe
Scopes Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
v
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
Dependency Injection
How components get ahold of their dependencies
Dependency Injection
Two notations to inject
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
v
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
Reuseable component
A service/factory in Angular is:
Lazy instantiated
Singleton
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
s
e
i
r
o
t
Fac
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
Fa
s
e
i
r
o
t
c
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
Fa
s
e
i
r
cto
Valid
ator
Filters
Modify expressions
Filters
AngularJS provided filters
lowercase
date
number
filter
orderBy
json
uppercase
limitTo
20th June 2014, Armin Rdiger Vieweg (@ArminVieweg)
Getting started with superheroic JavaScript library AngularJS
Filters
Usage examples
Filters
Writing your own filters
app.filter('replaceVowelsWith', function(){
return function(input, option){
if (option === undefined || input === undefined) return input;
return input.replace(/[aeiou]/gi, option);
}
});
{{'Drei Chinesen mit dem Kontrabass...' | 'e'}}
Dree Chenesen met dem Kentrebess...
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
Fa
s
e
i
r
cto
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
Fa
s
e
i
r
cto
Valid
ator
Validators
You're not coming in
Validators
Example
<form name="form" novalidate>
<input type="email" ng-model="mail" name="mail" required>
<button type="submit" ng-disabled="form.$invalid">Submit</button>
</form>
Validators
Your own validators/directives
Input must be
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
Fa
s
e
i
r
cto
Valid
ator
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
Fa
s
e
i
r
cto
Valid
a
tors
Providers
Almost every AngularJS buzzword is made by providers
Value
Constant
Factory
Service
Provider
Providers
Small example with value and constant provider
var app = angular.module('myFirstApp', []);
app.value('bestCmsEver', 'TYPO3');
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
Fa
s
e
i
r
cto
Valid
a
tors
AngularJS Buzzwords
Expressions
Modules Two-wa
y Dat
a Bin
ding
s
e
i
n
t
o
i
c
t
s
c
r
nje
I
olle
r
y
t
c
Dire
n
n
Co
de
n
e
p
e
D
Scopes Filters
Providers
Services
Fa
s
e
i
r
cto
Valid
a
tors
Advantages of AngularJS
Allows you to work clean using reuseable modules
Features of Angular
enables completely new possibilites (2-way data binding)
saves a lot of time for common tasks (like validation)
AngularJS help
Guide: https://docs.angularjs.org/guide
API: https://docs.angularjs.org/api
Many many articles, videos and examples on
YouTube
StackOverflow
all over the web
Workshop Schedule
1. Presentation
2. Live Coding Examples
3. Practicing AngularJS
Workshop Schedule
1. Presentation
2. Live Coding Examples
3. Practicing AngularJS
15 minute break
ttention!