logo资料库

AngularJs in Action.pdf

第1页 / 共191页
第2页 / 共191页
第3页 / 共191页
第4页 / 共191页
第5页 / 共191页
第6页 / 共191页
第7页 / 共191页
第8页 / 共191页
资料共191页,剩余部分请下载后查看
AngularJS in Action
brief contents
contents
foreword
preface
acknowledgments
about this book
Roadmap
Source code conventions and downloads
Software requirements
Resources
Author Online
about the authors
about the cover illustration
Part 1: Get acquainted with AngularJS
Chapter 1: Hello AngularJS
1.1 Advantages of using AngularJS
1.2 The AngularJS big picture
1.3 Build your first AngularJS application
1.3.1 The module
1.3.2 Views and controllers
1.3.3 Services
1.3.4 Directives
1.4 Summary
Chapter 2: Structuring your AngularJS application
2.1 Hello Angello
2.2 AngularJS application structure
2.3 Laying the Angello foundation
2.4 Basic routes and navigation
2.5 A few best practices
2.6 Summary
Part 2: Make something with AngularJS
Chapter 3: Views and controllers
3.1 The big picture
3.2 What is an AngularJS view?
3.3 What is an AngularJS controller?
3.3.1 The digest cycle
3.3.2 Controller as syntax
3.3.3 AngularJS events
3.4 Properties and expressions
3.4.1 Display stories with ngRepeat
3.4.2 Filters
3.4.3 Expressions
3.5 Best practices and testing
3.6 Summary
Chapter 4: Models and services
4.1 What are models and services?
4.1.1 Hello services
4.1.2 The service lifecycle
4.1.3 The different types of services
4.2 Models with $http
4.2.1 What is $http?
4.2.2 Create your first model
4.2.3 $http convenience methods
4.3 Promises
4.3.1 What are promises?
4.3.2 Promises in action
4.3.3 $http.success and $http.error
4.3.4 Elegant sequencing with promises
4.4 $http interceptors
4.4.1 Why intercept?
4.4.2 Interceptors in action
4.5 Service decorators
4.5.1 Why decorate?
4.5.2 Enhanced logging
4.6 Testing consideration
4.6.1 Testing a service
4.6.2 Using $httpBackend to mock server calls
4.6.3 Best practices
4.7 Summary
Chapter 5: Directives
5.1 Introduction to directives
5.1.1 What are directives?
5.1.2 Why we need directives
5.1.3 Why we want directives
5.2 Directives 101: a quick foundation
5.2.1 The user story directive
5.3 A more advanced feature
5.3.1 The drag-and-drop feature
5.3.2 Use the drag-container directive
5.3.3 Build the controller
5.3.4 Create the drop-container directive
5.3.5 Use the drop-container directive
5.3.6 Build the controller
5.3.7 Create the drop-target directive
5.3.8 Use the drop-target directive
5.3.9 Build the controller
5.3.10 Create the $dragging service
5.3.11 Update the StoryboardCtrl
5.4 Integrating with third-party libraries again!
5.4.1 Install Flot
5.4.2 Build the directive
5.4.3 Use the directive
5.4.4 Massage our data
5.4.5 It’s time we had the “isolated scope talk”
5.4.6 Grand finale: breathe life into Flot
5.5 Testing a directive
5.6 Best practices
5.7 Summary
Chapter 6: Animations
6.1 Intro to animations
6.1.1 How AngularJS handles animations
6.1.2 The animation-naming convention
6.1.3 Animations enable!
6.2 CSS transitions
6.2.1 Define the base transition
6.2.2 Define the ng-enter transitions
6.2.3 Define the ng-leave transitions
6.2.4 Making it move
6.3 CSS animations
6.3.1 Define the base animation classes
6.3.2 Define the animation keyframes
6.3.3 Make it move
6.4 JavaScript animations
6.4.1 Defining the JavaScript animation
6.4.2 The JavaScript animation events
6.4.3 The JavaScript animation class
6.4.4 TweenMax
6.4.5 Making it move
6.5 Testing
6.6 Best practices
6.7 Summary
Chapter 7: Structuring your site with routes
7.1 The components of AngularJS routes
7.2 How to create routes in AngularJS
7.2.1 Create your first route with ngRoute and ngView
7.2.2 Add ngView
7.2.3 Set up your route with $routeProvider
7.2.4 Set up route navigation
7.2.5 Review
7.3 Using parameters with routes
7.3.1 Review
7.4 Using resolve with routes
7.4.1 Review
7.5 Route events
7.5.1 Review
7.6 Testing
7.7 Best practices
7.8 Summary
Chapter 8: Forms and validations
8.1 The big picture: AngularJS form validation
8.1.1 Extending HTML form elements
8.1.2 Adding validations
8.1.3 Form validation and CSS
8.1.4 Form validation, $setPristine, and $setUntouched
8.2 Testing
8.3 Best practices
8.4 Summary
appendix A: Setting up Karma
Setting up Karma
Install Node.js and Node Package Manager (npm)
Install packages
Initialize Karma
Use Karma
appendix B: Setting up a Node.js server
Setting up a Node.js server
Install Node.js (with Node Package Manager, a.k.a. npm) and MongoDB
Initialize the repo
Update EndpointConfigService.js
A note about Auth0
appendix C: Setting up a Firebase server
Setting up a Firebase server
Set up an account with Firebase
Create your first app
Bootstrap your Firebase app to Angello
A note about Auth0
appendix D: Running the app
Running the app
Get the code
Start the server
View the app
index
Symbols
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
R
S
T
U
V
W
X
IN ACTION Lukas Ruebbelke FOREWORD BY Martin Gontovnikas M A N N I N G
AngularJS in Action Licensed to Mark Watson
Licensed to Mark Watson
AngularJS in Action LUKAS RUEBBELKE with BRIAN FORD M A N N I N G Shelter Island Licensed to Mark Watson
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: orders@manning.com ©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. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Development editor: Cynthia Kane Technical development editor: Leonardo Cassarani Copyeditor: Benjamin Berg 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
To my father, Daniel Ruebbelke, who is the foundation of my life Licensed to Mark Watson
Licensed to Mark Watson
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
分享到:
收藏