AngularJS in Action
Lukas Ruebbelke with Brian Ford
Copyright
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 DepartmentManning Publications Co.20 Baldwin RoadPO Box 761Shelter Island, NY 11964Email:
orders@manning.com2015 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 Mannings 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 RoadPO Box 761Shelter Island, NY 11964 | Development editor: Cynthia KaneTechnical development editor: Leonardo CassaraniCopyeditor: Benjamin BergProofreader: Katie TennantTechnical proofreader: Richard Scott-RobinsonTypesetter: Gordan SalinovicCover 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
Dedication
To my father, Daniel Ruebbelke, who is the foundation of my life
Brief Table of Contents
Table of Contents
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. Its also one of the most rapidly changing frameworks out there. In this book, youll 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 Angulars features, in this book youll get a quick glance at what they are and then get your hands dirty so you can learn by using them! Youll learn not only how to code this application, but also how to test it.
Angello is the exciting applicationit uses some of the most interesting libraries out there for AngularJS. Its a project management tool very similar to Trello. Throughout the book, youll learn how to implement the different pieces of this application, and how to use ui-router, Auth0, and Firebase, among others.
I know youll find this book really useful. Happy hacking!
M ARTIN G ONTOVNIKAS
D EVELOPER A DVOCATE , A UTH0
Preface
Never in my wildest dreams did I think that I would be an author, and yet here I am. I vividly remember the panic that I felt as I clicked Publish on my first WordPress post on AngularJS. It felt like I was pressing the launch button for a series of missiles, and I had no idea where they would go! Little did I know that I had in fact released a series of missiles that would change my life in the most profound and unexpected ways.
The moment I decided that I cared more about being helpful than being perfect was one of the most important turning points of my life. Beginning with a series of barely passable blog posts, by accepting every opportunity to implement feedback I gradually grasped what it takes to write a solid blog post. It was also during that time that I had the opportunity to become friends with the AngularJS core team. AngularJS at the time was still relatively unknown, and so it was much easier to get on their radar than it is now. Lucky me!
Ill never forget that afternoon when I got the email asking if I was interested in writing this book. When I was pretty sure that no one was looking, I would break out into this little happy dance for days. If only my high school English teacher could see me now!
From that moment, I have considered it a great privilege to share with you the things Ive learned while building some large applications and writing untold lines of AngularJS code. Its been a most excellent journey, and I thank each and every one of you for making this possible!
L UKAS R UEBBELKE
Acknowledgments
This book wouldnt have been possible without the input and support from the amazing AngularJS community. I want to thank Brad Green, Igor Minar, Miko Hevery, Brian Ford, and Matias Niemela for their friendship and for setting such a great example of what it looks like to build awesome things. I would also like to thank Jeff Whelpley, Brandon Tilley, Omar Gonzalez, Martin Gontovnikas, Joe Eames, and about a hundred other people for their feedback. They helped me craft Angello and the book thats built around it. I would also like to thank Geoff Goodman for his contributions on the awesome drag-and-drop example. And I owe Jonathan Garvey a huge debt of gratitude for helping me get this book over the finish line. You are holding this book right now because of his help and tough love. Special thanks to Martin for penning the foreword to the book, and to Brian for his contributions at the beginning of the project.
I especially want to thank my saint of an editor, Cynthia Kane, for her infinite patience, for helping me to become a better writer, and for sometimes nudging me to do things I didnt want to dolike write! Thanks also to everyone else on the Manning team who worked with me during the development and production of the book.
Many people read early drafts of the manuscript and sent in corrections and comments as it was being written, including numerous MEAP (Manning Early Access Program) readers, as well as the following reviewers: Ahmed Khattab, Brian Cooksey, Chad Davis, Daniel Bretoi, Fernando Monteiro Kobayashi, Gregor Zurowski, Jeelani Shaik, Jeff Condal, Jeff Cunningham, Richard Scott-Robinson, Robert Casto, Roberto Rojas, and William E. Wheeler. Thanks to all, with a special acknowledgment to technical proofreader Richard Scott-Robinson, who checked the code and read the manuscript one last time, shortly before it went into production.
About this Book
The goal of this book is to equip you, the reader, with an arsenal of practical techniques that you can use in the real worldto help you build a non-trivial web application from the ground up, and offer commentary on the most pertinent pieces. The sample application presented in the book, Angello, comes with a fully functional back end in either Firebase or Node.js with a few extra bonuses such as social logins with Auth0.
We had to make some hard decisions about what we were going to cover in the book and, more importantly, what we would not cover. It would have been easy to go down a rabbit trail as we tried to explain AngularJS on a molecular level, but the actual application of this knowledge is relegated to edge cases at best. Well be the first to admit that we dont cover everything about AngularJSthat would make for a book three times the size of what is currently in your possession.