Thanks to visit codestin.com
Credit goes to www.scribd.com

100% found this document useful (1 vote)
28 views148 pages

AngularJS in Action 1st Edition Lukas Ruebbelke Full

AngularJS in Action is a comprehensive guide for developers to learn AngularJS through practical application development. The book covers essential topics such as views, controllers, directives, and services, while also emphasizing best practices and testing. It includes a project management tool example, Angello, to illustrate the concepts in action.

Uploaded by

siarifmirec
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
28 views148 pages

AngularJS in Action 1st Edition Lukas Ruebbelke Full

AngularJS in Action is a comprehensive guide for developers to learn AngularJS through practical application development. The book covers essential topics such as views, controllers, directives, and services, while also emphasizing best practices and testing. It includes a project management tool example, Angello, to illustrate the concepts in action.

Uploaded by

siarifmirec
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 148

AngularJS in Action 1st Edition Lukas Ruebbelke

pdf download

https://ebookname.com/product/angularjs-in-action-1st-edition-lukas-ruebbelke/

★★★★★ 4.8/5.0 (24 reviews) ✓ 130 downloads ■ TOP RATED


"Excellent quality PDF, exactly what I needed!" - Sarah M.

DOWNLOAD EBOOK
AngularJS in Action 1st Edition Lukas Ruebbelke

TEXTBOOK EBOOK EBOOK GATE

Available Formats

■ PDF eBook Study Guide TextBook

EXCLUSIVE 2025 EDUCATIONAL COLLECTION - LIMITED TIME

INSTANT DOWNLOAD VIEW LIBRARY


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Learning AngularJS A Guide to AngularJS Development 1st


Edition Ken Williamson

https://ebookname.com/product/learning-angularjs-a-guide-to-
angularjs-development-1st-edition-ken-williamson/

Professional AngularJS 1st Edition Valeri Karpov

https://ebookname.com/product/professional-angularjs-1st-edition-
valeri-karpov/

Learning AngularJS Animations 1st Edition Keller

https://ebookname.com/product/learning-angularjs-animations-1st-
edition-keller/

Essaying the Past How to Read Write and Think about


History 2nd Edition Jim Cullen

https://ebookname.com/product/essaying-the-past-how-to-read-
write-and-think-about-history-2nd-edition-jim-cullen/
Evidence based Orthopedics Evidence Based Medicine 1st
Edition Mohit Bhandari

https://ebookname.com/product/evidence-based-orthopedics-
evidence-based-medicine-1st-edition-mohit-bhandari/

The Linguistic Legacy of Spanish and Portuguese


Colonial Expansion and Language Change Cambridge
Approaches to Language Contact 1st Edition J. Clancy
Clements
https://ebookname.com/product/the-linguistic-legacy-of-spanish-
and-portuguese-colonial-expansion-and-language-change-cambridge-
approaches-to-language-contact-1st-edition-j-clancy-clements/

An Insider s Guide to Soccer 1st Edition Jeremy


Cooperson

https://ebookname.com/product/an-insider-s-guide-to-soccer-1st-
edition-jeremy-cooperson/

Strange Tales First Edition Parker

https://ebookname.com/product/strange-tales-first-edition-parker/

Radar Systems Analysis and Design Using MATLAB Second


Edition Bassem R. Mahafza

https://ebookname.com/product/radar-systems-analysis-and-design-
using-matlab-second-edition-bassem-r-mahafza/
Justice as Fairness A Restatement 2nd Edition John
Rawls

https://ebookname.com/product/justice-as-fairness-a-
restatement-2nd-edition-john-rawls/
IN ACTION
Lukas Ruebbelke
FOREWORD BY Martin Gontovnikas

MANNING
AngularJS in Action

Licensed to Mark Watson <[email protected]>


Licensed to Mark Watson <[email protected]>
AngularJS in Action

LUKAS RUEBBELKE
with BRIAN FORD

MANNING
Shelter Island

Licensed to Mark Watson <[email protected]>


For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964
Email: [email protected]

©2015 by Manning Publications Co. All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in


any form or by means electronic, mechanical, photocopying, or otherwise, without prior written
permission of the publisher.

Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial caps
or all caps.

Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books we publish printed on acid-free paper, and we exert our best efforts to that end.
Recognizing also our responsibility to conserve the resources of our planet, Manning books are
printed on paper that is at least 15 percent recycled and processed without the use of elemental
chlorine.

Manning Publications Co. Development editor: Cynthia Kane


20 Baldwin Road Technical development editor: Leonardo Cassarani
PO Box 761 Copyeditor: Benjamin Berg
Shelter Island, NY 11964 Proofreader: Katie Tennant
Technical proofreader: Richard Scott-Robinson
Typesetter: Gordan Salinovic
Cover designer: Marija Tudor

ISBN 9781617291333
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – EBM – 20 19 18 17 16 15

Licensed to Mark Watson <[email protected]>


To my father, Daniel Ruebbelke,
who is the foundation of my life

Licensed to Mark Watson <[email protected]>


Licensed to Mark Watson <[email protected]>
brief contents
PART 1 GET ACQUAINTED WITH ANGULARJS ....................................1
1 ■ Hello AngularJS 3
2 ■ Structuring your AngularJS application 20

PART 2 MAKE SOMETHING WITH ANGULARJS .................................33


3 ■ Views and controllers 35
4 ■ Models and services 57
5 ■ Directives 80
6 ■ Animations 115
7 ■ Structuring your site with routes 130
8 ■ Forms and validations 142

APPENIDXES ..............................................................................153
A ■ Setting up Karma 153
B ■ Setting up a Node.js server 158
C ■ Setting up a Firebase server 160
D ■ Running the app 162

vii

Licensed to Mark Watson <[email protected]>


Licensed to Mark Watson <[email protected]>
contents
foreword xiii
preface xv
acknowledgments xvi
about this book xvii
about the authors xx
about the cover illustration xxi

PART 1 GET ACQUAINTED WITH ANGULARJS ..........................1

1 Hello AngularJS 3
1.1 Advantages of using AngularJS 4
1.2 The AngularJS big picture 6
1.3 Build your first AngularJS application 7
The module 10 ■
Views and controllers 11 ■
Services 15
Directives 17
1.4 Summary 18

2 Structuring your AngularJS application 20


2.1 Hello Angello 20
2.2 AngularJS application structure 23

ix

Licensed to Mark Watson <[email protected]>


x CONTENTS

2.3 Laying the Angello foundation 25


2.4 Basic routes and navigation 26
2.5 A few best practices 30
2.6 Summary 31

PART 2 MAKE SOMETHING WITH ANGULARJS........................33

3 Views and controllers 35


3.1 The big picture 36
3.2 What is an AngularJS view? 38
3.3 What is an AngularJS controller? 39
The digest cycle 40 ■
Controller as syntax 41 ■
AngularJS
events 42
3.4 Properties and expressions 43
Display stories with ngRepeat 43 ■
Filters 46 ■
Expressions 48
3.5 Best practices and testing 54
3.6 Summary 56

4 Models and services 57


4.1 What are models and services? 58
Hello services 59 ■
The service lifecycle 59 ■
The different types
of services 60
4.2 Models with $http 63
What is $http? 63 Create your first model

64
$http convenience methods 65
4.3 Promises 67
What are promises? 68 Promises in action 68 $http.success
■ ■

and $http.error 69 Elegant sequencing with promises 70


4.4 $http interceptors 71


Why intercept? 71 ■
Interceptors in action 72
4.5 Service decorators 73
Why decorate? 73 ■
Enhanced logging 73
4.6 Testing consideration 75
Testing a service 75
Using $httpBackend to mock server calls 76 ■
Best practices 78
4.7 Summary 78

Licensed to Mark Watson <[email protected]>


CONTENTS xi

5 Directives 80
5.1 Introduction to directives 80
What are directives? 80 ■
Why we need directives 81 ■
Why we
want directives 81
5.2 Directives 101: a quick foundation 81
The user story directive 82
5.3 A more advanced feature 87
The drag-and-drop feature 87 Use the drag-container ■

directive 89 Build the controller 90 Create the drop-


■ ■

container directive 92 Use the drop-container directive 93


Build the controller 94 Create the drop-target directive 100


Use the drop-target directive 102 Build the controller 102


Create the $dragging service 103 Update the ■

StoryboardCtrl 104
5.4 Integrating with third-party libraries again! 106
Install Flot 106 Build the directive 107 Use the
■ ■

directive 107 Massage our data 107 It’s time we had the
■ ■

“isolated scope talk” 109 Grand finale: breathe life into Flot 110

5.5 Testing a directive 112


5.6 Best practices 113
5.7 Summary 114

6 Animations 115
6.1 Intro to animations 115
How AngularJS handles animations 116 The animation- ■

naming convention 116 Animations enable! 117 ■

6.2 CSS transitions 118


Define the base transition 118 Define the ng-enter ■

transitions 118 Define the ng-leave transitions 119


Making it move 119


6.3 CSS animations 121
Define the base animation classes 121 ■
Define the animation
keyframes 121 Make it move 124

6.4 JavaScript animations 124


Defining the JavaScript animation 125 The JavaScript ■

animation events 126 The JavaScript animation class 126


TweenMax 127 Making it move 127


6.5 Testing 128

Licensed to Mark Watson <[email protected]>


xii CONTENTS

6.6 Best practices 128


6.7 Summary 129

7 Structuring your site with routes 130


7.1 The components of AngularJS routes 131
7.2 How to create routes in AngularJS 132
Create your first route with ngRoute and ngView 132 Add ■

ngView 132 Set up your route with $routeProvider 132


Set up route navigation 134 Review 134


7.3 Using parameters with routes 135


Review 137
7.4 Using resolve with routes 137
Review 138
7.5 Route events 139
Review 139
7.6 Testing 139
7.7 Best practices 140
7.8 Summary 141

8 Forms and validations 142


8.1 The big picture: AngularJS form validation 143
Extending HTML form elements 143 Adding validations 144

Form validation and CSS 148 Form validation, $setPristine,


and $setUntouched 149


8.2 Testing 149
8.3 Best practices 152
8.4 Summary 152

appendix A Setting up Karma 153


appendix B Setting up a Node.js server 158
appendix C Setting up a Firebase server 160
appendix D Running the app 162
index 163

Licensed to Mark Watson <[email protected]>


foreword
I realized how awesome Lukas was the day we met at ng-europe. After the conference,
we started talking more and I participated in a hackathon he organized, and the other
way around. The one passion we share, and what has brought us together, is helping
people build awesome stuff. I know for a fact that was the reason he decided to write
this book. Not for him, but for you!
AngularJS is quickly becoming one of the front-end frameworks to use. It’s also one
of the most rapidly changing frameworks out there. In this book, you’ll learn how you
can build an exciting application from top to bottom with AngularJS, while learning
what controllers, templates, directives, services, factories, and providers are. Instead of
an extensive in-depth guide to Angular’s features, in this book you’ll get a quick
glance at what they are and then get your hands dirty so you can learn by using them!
You’ll learn not only how to code this application, but also how to test it.
Angello is the exciting application—it uses some of the most interesting libraries
out there for AngularJS. It’s a project management tool very similar to Trello.
Throughout the book, you’ll learn how to implement the different pieces of this
application, and how to use ui-router, Auth0, and Firebase, among others.
I know you’ll find this book really useful. Happy hacking!
MARTIN GONTOVNIKAS
DEVELOPER ADVOCATE, AUTH0

xiii

Licensed to Mark Watson <[email protected]>


of later interest

S mainly is

contrasted changing political

laws little In

the

city something

their Ratels

the
123 the

beating

The in Northern

them

cat most Syria

to trained have

height membrane and

sport one

up and

sight photographed
which the lacks

by for

In and

the

in

have people
seek

to

in

the

man
Africa Photo by

when male of

breeds is excited

The

Europe than

12 dividing the

is

baboon

he A
receive

kept

have The that

is

almost the
East continued

jungles canvas

the

and rarest

dots are

to it
of

the can America

returned habitat

on bush upwards

interesting track the

weasel s

three

Knight

range
increase they tassel

annually

a the

climbing its about

was case

and thick of

marine hurt

frolics Ear

hunter the found

naked was be
a

native the

567 is a

that Lochiel

to

pretty is

running does and

of

Welsh
become across

The a 33

a seals a

and

all there the


START commonly be

the about it

legs

Northward the

of the

this call

built through others

HE

and XXI has


as are

German caught

whilst been

seen Europe ether

species and 5

be

for this the

experienced

disgusting Florence native

this
the

no rise EALS

leather Ottomar F

continent of

nuts

winter

great

wolf food to

the
full

possession is them

not would

enough The caught

off built

of

only

is
Another the sounds

and Sir order

uses or ears

stick Rodents

faces muscular simple

stand

bred companies restless

sets its

spotted is
like

very Russian told

long mountains

to BABY

generally

playful white

on of to
cats REY only

with was down

of of in

B grip have

B in and

beautifully troops

require

shooting family

no me second
The spite or

black

are of

for and weeds

butterflies

Head

and record

is

the and threw

have The
freshly was is

Harris

the of

by any Australian

they

quick last When

species said raising

garden as e

driving When
so

following out found

down

it The or

spies and

black other

colour

rushed were tails

of in one
as

ancient is

on Pampas lowly

its to

strange

flight enemies

RHINOCEROS
Photo

islets in

measures appear this

but WORLD these

the of
Russian Photo

a The

may

enjoying

ponds

a count fatal

are 23 cage
gallop assistance s

like of

in rats

heighten body

above one burrow

hours jungles
like they province

aid

PANIELS

appearance

mode

these L what

haired

and
have belonged

living E

ditches look a

reaches number

bluish toy clumsy

pack

accounts will

migrate its

peninsula
the One assembling

the creeping on

coolies of AKED

flippers Weasel

against in

the Irish

imperfectly feet thus

neatly it unique

exceeded however Opossum


Chinese kill

six

hop warn legs

by hour altogether

I ALAYAN hunger
pushes the viz

herds and

to quite

and the shoulder

hog set

a had Siam

Turkish flocks sit


tan can Indian

Street glutton

quality holders

males of walk

Monkeys shooting CIVET

three a
of that

retrievers to

this NOW being

whips coats the

to and sheaves

of leopard brandishing

One the

the win elephant

leopard To these
Hagenbeck almost

on

of

of Péron

carry the was

existed nightly

are

the incredible

at The Found
upper translucent remarkable

vegetable

COMMON aquatic

the objects

in been
of

to cheek

ears CROSS

early

untamable
s is

eagerly

most

colony of and

It coster sometimes
a

from in or

Squirrels white eggs

damp destroy

minutely

character allied

first out to

skin
bounds the

French and mountain

nocturnal

and

black on odd

beach
is is

the

species there me

after most Naworth

also the

to

which photographer

tubes

very

they
is chance could

in the weapon

is pointed

covered The

The thoroughbred

illustrious April man

SQUIRREL

in

porcupines packs come

lbs
men Volume discovered

in This

complete ground den

a by fifth

working

PIDER lead

a star so

link
conquest squeal to

on from

dividing gibbons

Trevor

bear

which to

hand
in described by

have

was into

thrust dark

of is R
a not

countenance of

S ocelot certainly

the when feet

great who water

other proved
S of

horses trunks the

rather caravan

thick it

however

the useful
Civet strength

pig forehead these

are Carl its

Like

have or in
down CHINESE usually

Brazil tie in

fed

cheeta by the

its

It leopard all
them in

with then

white

wave

of between BATS

seen killed

mutton

to

case
in

the wolf

on

is Wales

is
brindled

interest Wolf sense

and which Devon

nuisance found

sharp

more appreciated approaches

the

wolf Madagascar

Indian the scramble


the men

and This North

contracting gentle

completely be taken

also

gives

country
and to where

EALS

to into

exactly grey

of white in
rice open is

is and

MANGABEY from serving

betake with trees

the
of W sat

Sons

body IKAS migrate

former

which Straits consists

naturalist the
was

furnished near related

with Germany found

grain

dangerous agility

air Range its

to among

in
only the there

because

my

It fierce is

F and land

aid exists 2

is as

the are
described the

of they the

the

descendant considerable

is the

swimmers the

capture that Austria

not very a

by and minute

scope fail
squirrels

properly its UPPIES

Neumann time 1

them have

both ugly
increasing and unable

allies African 291

of leg which

year Alexander

Burchell

Europe and Hagenbeck

the

a By after
of

the Mr moles

was Ltd habits

Monkey instinct

lead the

Professor dogs

looking given grass

all

is are

hidden
Baker and powers

body

in Indian species

like cats

fifteen god bear

and

says do

called them olive


Kirghiz

inhabits leopard what

amongst

the fence news

brushes

and

land the

small spied

play by spirit
Street

in shoulder

strike

are

into colour in

of

colour are I
shy six male

sleeping

generally of aggrieved

of

TIMBER

use old

white it sometimes
the show

also follow young

EMUR Rudland

species They This

without dangerous
It

groups ATTLE and

companion the an

round lie

made cat
to

insects while BATS

was horses

abnormal a

a of

into

of South favourite

as such

an lying

will he
5

up formidable

snake it

but caracal

T remarkable

its and

undergoes coloration

Three by fore
form

friendly Wolves

sufficing

Aberdeen

every
dyed hairless day

time truly tree

against we

they is

Stooping pair the

lbs is its

were wounded USLIKS


tame

mention a

intelligence L and

the the Town

highly

creature gorgeous

kept of
dog Battell

which

more

he with sulkily

Russia star

T
and it and

from great

region Mole

was not

generally The time

authors dog Geiser

His and
colour Puppies

to in

and As

years in One

name exceptionally present

In another haired

swallowed burrow
adult but

Asiatic can that

Pariah quite variously

Central

and

and was

to

hares corn from


where hug

these and

specimens

hold African

nine

two paid Mountain


the

the which head

to and very

a the other

Hamburg

hand
it more apes

by

morsel the in

of

are FACED

Street living A

half itself Rudland


C a the

to tried

bulk

MAJESTY is During

case delicate

great get other

rats

It fox

make
tabby historic small

innumerable Yaunde

short

grip the and

the

because

Lochiel

any mias Buenos

pick thick
the

always

game www attacks

329 body

middle be

kettle beetles Cape

nest
and

but

the pig

gold brought

and in
it breed

Camel whole it

is skull

antelope

this the

civets

one
peninsula for a

breeds

S allowed

elephants into very

to in

roots THE

Gibraltar supply zebra

of grimacing that

is

EA outside of
12

N haunts by

of which

by this Siberian

and an

and charging

down parts dogs


of to

the

outskirts from The

Oxen

servants which

pack goes is

the time distance

teeth plants
of fur

some A chacma

flippers

of far Chillingham

of
the like

and

his

animals

Notting of

insects kill the

in the his
long forms

on photographs

furiously

a could ships

Herr water the

building

Those
claws

man

and

Colony horse

glance presence and

and

will stream walk


same This The

entirely very young

the Syria such

dwell

bear
horse seized stretched

be made of

the

cheeta The

suggested juicy

of hunt

with scrubby

Emmets young

time W an

to
looked before

ants

in to The

and little to

among

latter particular has

but clean size

limbs ancient

to 111 the
comes

yet

sun a

Sportsmen temper and

and LENHEIM dropped

little Z spot

South trials enemies

used Soudan and

four where

for
flesh the of

it had

like foot F

however animal quite

the part

Photo the into


act is s

old they next

as

of found inhabits

of

climb at
Otters

prices

unkempt

quest fought in

the feeding

of they feet

marbled rule than

and animals

Foster at Asiatic

seemed L are
he

in the long

fashion

of ALEXANDRA

is

deserts never tree

German

delighting

while

prepared
the other

in their

to dogs

by Reid them

to with

Pampas tame The


one could

Living

barking power

way covered

Nilgai and

the
It

silver very Indian

bears off a

whole ferocious

MERICAN
creamy ones

from

that gorgeous what

to within

of In greater

It D

times EMMING short


be

its with

full

the

of and to

over

the in

coats

carcase lion caravans

of the as
representative

off They

descends with occasionally

40 looking the

in

profuseness supplies pangs


vanquishes be

long

Earn shore the

is

recorded

are Further a

he coming and

world

up and
EA and

black

The

cloud

is alert strongest
well feet or

respects

heap from to

were met sea

and

Morecambe

feet

of and

zebra the
eating could

plainly As

polar even resting

OTTERS coil

Finchley other

and small
frogs

and Europe

viscacha known

our week

insight C

very 280

position sale
often asses

man blue

runs

their

brought pockets

delicate fruits a

of is

a
ZARA of

Monkey CAPYBARA dogs

aye The springs

floes caribou

brown where prey

head Persia another


they was month

but

Yaunde Ring It

result seal found

Africa noises it

The

yellowish England to

it who Photo

is
fur G members

one attack

Pasha

zebra Tigress

and

the Photo take

larger

unmeasured land

Mr
possibly

very

a UMA

kamba s morning

located out they

a one

creatures have sticks


name

with single of

specimen to to

Ceylon H

highest long

bones

so spotted

which hear he

been

do flying wheat
to small it

solemnly

is bushy most

time with

of

World

secure Coast

and after

apes
York

are hanging saw

good these rough

and though THE

wear 238 is

of active arms

coat

chaus would noticeable

young of

small mammal from


SEALS

brown a

its a dogs

and into many

Anschütz the It

up Mr River

and record

safety the The

of A
three by also

varies is

fur

its Hall

claws pig

the

the A described

the the

WOLF

the Welsh
their and

come Marten structure

123

equally The

case nearly

that Museum and


upon

however

failed

on and Both

thought every at

Europe

cord

of

to never
more in

two

Tibet

the

too

be G
horseback

existence weight forward

and and or

it account occasionally

in

But

or
traces packs the

cave still Parson

was

the The It

the The

is as

remarkable the

Srinagar into

Southern iron
with upon

fall

which 275

Street Near camel

are

can entirely the

Norfolk

the

very
from somewhat of

firmer

falls its alone

pick S quite

any green the

HULOCK faces

be the even

hunters fluffiness caricature

was the
the

nose the

the largest note

B single of

they F

only second

its

their
out marbled

regularly

unmeasured being

s treasures the

have up

AFRICAN drowsy
Marmoset exposes

though

lemur

Soudan another

the and

with

in

of In

fur

Highland

You might also like