Learning Angular 2 Your quick, no-nonsense guide to building real-world apps with Angular 2 Pablo Deeleman BIRMINGHAM - MUMBAI Learning Angular 2 Copyright © 2016 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: May 2016 Production reference: 2260516 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78588-207-4 www.packtpub.com Credits Author Project Coordinator Pablo Deeleman Sanchita Mandal Reviewer Proofreader Johannes Weber Safis Editing Commissioning Editor Indexer Sarah Crofton Priya Sane Acquisition Editor Graphics Reshma Raman Kirk D'Penha Content Development Editor Production Coordinator Samantha Gonsalves Nilesh R. Mohite Technical Editor Cover Work Mohita Vyas Nilesh R. Mohite Copy Editors Roshni Banerjee Akshata Lobo About the Author Pablo Deeleman is a former UX designer and frontend engineer who discovered the Web back in the 90s, when a 14,400 bps modem was the key to an unparalleled world of marvels and a build-your-own-website was the name of the game. After getting his BA (Hons) degree in marketing and moving through different roles in the advertising arena, he took his chance and evolved into a self-taught, passionate UX designer and frontend developer with a crunch for beautifully crafted CSS layouts and JavaScript thick clients, having produced countless interactive designs and web desktop and mobile applications ever since. During these years, he has fulfilled his career as both an UX designer and frontend developer by successfully leading Internet projects for a wide range of clients and teams, encompassing European online travel operators, Silicon Valley-based start-ups, international heavy-traffic tube websites, global banking portals, or gambling and mobile gaming companies, just to name a few. At some point along this journey, the rise of Node.js and single-page-application frameworks became a turning point in his career, being currently focused on building JavaScript-driven web experiences. After having lived and worked in several countries, Pablo Deeleman currently lives in Barcelona, Spain, where he leads the frontend endeavor in the Barcelona studio of Gameloft, the world leader in mobile gaming, and the home of internationally acclaimed games, such as Despicable Me: Minions Rush and Asphalt 8. When not writing books or taking part in industry events and talks, he spends most of his time fulfilling his other passion: playing piano and guitar. Acknowledgments The book you hold in your hands right now is the result of a lot of time, effort, and sacrifice. Someone wisely said once that writing a book about a framework in the alpha stage is like aiming at a moving target, and indeed it is. During the writing, the author and the team involved in this project wound up losing track of how many times we had rewritten everything to conform to the latest incarnation of the framework. In the heat of the battle, it is quite easy to fall under the weight of frustration and seriously consider whether such a project is worth the effort or not. In that sense, this is why I only have words of appreciation for the team at Packt and most particularly for Samantha Gonsalves. Her kind words of support fueled the energy I needed to move this project ahead. I would also like to specially thank my friend and tech author Jorge Ferrando for his guidance and hints during the production process for this book. His expertise in Angular 2 became priceless when assessing the different courses of action to deliver the best learning experience. A mention is required as well for our other fellow developers Javier Gómez, Alfonso Fernández, Fran Iruela, and Pedro Narciso. I'd like to also thank the people who have mentored me and accompanied me along this professional journey over these years, with a special mention for the people at Casumo and Gameloft, and most specifically and in no particular order, for Razmus Svenningson, Kim Larsen, Josef Galea, Steve Attard, Iden Azzopardi, Renald Dalli, Matthew Borg, Mark Busuttil, Gerard Giné, Antonio González, Albert Puértolas, Rafael Marfil and the always inspiring Stuart Langridge. About the Reviewer Johannes Weber is a passionate developer and adviser in the field of web technologies spotlighted on enterprise JS apps. He works for Mayflower GmbH (Munich, Germany), where he focuses on the migration of SPA and MPA. In his free time, he (co)organizes the AngularJS Munich meetups, AngularCamp and JS-Kongress.de. Johannes cofounded ESnextNews.com, where you get five great ECMAScript.next links every week in your inbox. www.PacktPub.com eBooks, discount offers, and more Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why subscribe? • Fully searchable across every book published by Packt • Copy and paste, print, and bookmark content • On demand and accessible via a web browser This book is dedicated to my parents Paul and Pepa, and in the loving memory of my brother José Raúl. You will live forever in our hearts.