Angular 2 Components
By Nir Kaufman and Thierry Templier
()
About this ebook
Related to Angular 2 Components
Related ebooks
Learning AngularJS Animations Rating: 4 out of 5 stars4/5Getting Started with Angular - Second Edition Rating: 0 out of 5 stars0 ratingsObject Oriented Programming with Angular: Build and Deploy Your Web Application Using Angular with Ease ( English Edition) Rating: 0 out of 5 stars0 ratingsASP.NET Core for Jobseekers: Build Career in Designing Cross-Platform Web Applications Using Razor and Entity Framework Core Rating: 0 out of 5 stars0 ratingsDeploying Node.js Rating: 5 out of 5 stars5/5ASP.NET Core 3 and React: Hands-On full stack web development using ASP.NET Core, React, and TypeScript 3 Rating: 0 out of 5 stars0 ratingsReactJS for Jobseekers: The Only Guide You Need to Learn React and Crack Interviews (English Edition) Rating: 0 out of 5 stars0 ratingsGetting Started with React Rating: 0 out of 5 stars0 ratingsTypeScript Essentials Rating: 4 out of 5 stars4/5Learning Angular for .NET Developers Rating: 0 out of 5 stars0 ratingsJasmine JavaScript Testing - Second Edition Rating: 0 out of 5 stars0 ratingsAngular Services Rating: 0 out of 5 stars0 ratingsGetting Started with React Native Rating: 4 out of 5 stars4/5Angular Essentials: The Essential Guide to Learn Angular Rating: 0 out of 5 stars0 ratingsJavaScript Unlocked Rating: 5 out of 5 stars5/5React Components Rating: 0 out of 5 stars0 ratingsReact Design Patterns and Best Practices Rating: 0 out of 5 stars0 ratingsLearning Behavior-driven Development with JavaScript Rating: 5 out of 5 stars5/5JavaScript and JSON Essentials Rating: 5 out of 5 stars5/5ReactJS by Example - Building Modern Web Applications with React Rating: 4 out of 5 stars4/5Learning Single-page Web Application Development Rating: 0 out of 5 stars0 ratingsReactive State for Angular with NgRx Rating: 0 out of 5 stars0 ratingsReact Projects: Build 12 real-world applications from scratch using React, React Native, and React 360 Rating: 0 out of 5 stars0 ratingsLearning jQuery 3 - Fifth Edition Rating: 0 out of 5 stars0 ratingsWebSocket Essentials – Building Apps with HTML5 WebSockets Rating: 0 out of 5 stars0 ratingsjQuery Design Patterns Rating: 0 out of 5 stars0 ratingsSelenium Essentials Rating: 3 out of 5 stars3/5
Internet & Web For You
How to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsHow to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Coding For Dummies Rating: 5 out of 5 stars5/5Six Figure Blogging Blueprint Rating: 5 out of 5 stars5/5The Gothic Novel Collection Rating: 5 out of 5 stars5/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5How To Make Money Blogging: How I Replaced My Day-Job With My Blog and How You Can Start A Blog Today Rating: 4 out of 5 stars4/5No Place to Hide: Edward Snowden, the NSA, and the U.S. Surveillance State Rating: 4 out of 5 stars4/5Get Rich or Lie Trying: Ambition and Deceit in the New Influencer Economy Rating: 0 out of 5 stars0 ratingsEverybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5Podcasting For Dummies Rating: 4 out of 5 stars4/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 5 out of 5 stars5/5Wireless Hacking 101 Rating: 4 out of 5 stars4/5Stop Asking Questions: How to Lead High-Impact Interviews and Learn Anything from Anyone Rating: 5 out of 5 stars5/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5Create Something Awesome: How Creators are Profiting from Their Passion in the Creator Economy Rating: 0 out of 5 stars0 ratingsPython QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsCybersecurity For Dummies Rating: 4 out of 5 stars4/5Hacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5Six Figure Blogging In 3 Months Rating: 4 out of 5 stars4/5How To Start A Podcast Rating: 4 out of 5 stars4/5More Porn - Faster!: 50 Tips & Tools for Faster and More Efficient Porn Browsing Rating: 3 out of 5 stars3/5The Mega Box: The Ultimate Guide to the Best Free Resources on the Internet Rating: 4 out of 5 stars4/5How to Destroy Surveillance Capitalism Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5The Logo Brainstorm Book: A Comprehensive Guide for Exploring Design Directions Rating: 4 out of 5 stars4/5Surveillance and Surveillance Detection: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratings
Reviews for Angular 2 Components
0 ratings0 reviews
Book preview
Angular 2 Components - Nir Kaufman
Table of Contents
Angular 2 Components
Credits
About the Authors
About the Reviewers
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Angular 2 Component Architecture
The Model-View-Controller pattern
MVC in Angular 1
Moving from views to components
Defining components
Breaking the application into components
Summary
2. Setting Up an Angular 2 Development Environment with angular-cli
Node and npm
Installing Node
Introducing npm
Installing angular-cli
Generating an Angular 2 project
Choosing an IDE
Summary
3. The TypeScript Primer
Introduction to TypeScript
Managing dependencies with modules
The export and import statements
The default exports
Classes
The type system
The basic types
The custom types
About generics
Using decorators
Decorators versus annotations
Summary
4. Building a Basic Component
Bootstrapping the application
The component selector
Selector options
The component template
Embedding styles in component template
The shadow DOM
Encapsulation modes
Data bindings
Summary
5. Building Dynamic Components
Data interpolation
Core directives
NgIf
The asterisk – *
NgClass
NgStyle
NgSwitch
NgFor
Property bindings
Event bindings
Two-way bindings
Summary
6. Component Communication
Passing data via properties
Emitting custom events
Referencing with a local variable
Querying child components with the parent component
Summary
7. Putting It All Together
Preparing our development environment
The accordion component
Extending the accordion component tree
The component life cycle
Life cycle event interfaces
OnInit and OnDestroy
OnChanges
Other life cycle events
Summary
8. Integrating Third-Party Components
Preparing our development environment
Importing dependencies
Bootstrap tooltip component
Bootstrap collapse component
Summary
9. Angular 2 Directives
Components and directives in Angular 2
Preparing our development environment
The basic attribute directive
ElementRef and Renderer
Reacting to events from the host element
Passing properties to the directive
The basic structural directive
Summary
Index
Angular 2 Components
Angular 2 Components
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 authors, 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: November 2016
Production reference: 1211116
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-234-0
www.packtpub.com
Credits
Authors
Nir Kaufman
Thierry Templier
Reviewers
Robin Böhm
Daniel Zen
Commissioning Editor
Sarah Crofton
Acquisition Editor
Meeta Rajani
Technical Editor
Narsimha Pai
Copy Editor
Laxmi Subramanian
Proofreader
Safis Editing
Indexers
Hemangini Bari
Pratik Shirodkar
Production Coordinators
Deepika Naik
Shantanu N. Zagade
Cover Work
Deepika Naik
About the Authors
Nir Kaufman is the Head of Angular Development at 500Tech, a leading front-end consultancy in Israel. He is a passionate JavaScript developer, an international speaker, and an Angular evangelist.
Nir runs three local Angular community meetup groups in Israel. He also collaborates with other local Angular communities around the world.
Thierry Templier is a senior full stack developer with 17 years of experience. He has been a JavaScript addict for a long time now and started to work with the early versions of the language. He has a particular passion for Angular 2 and loves to help developers to use this framework, particularly on the StackOverflow website, where he has answered more than 1,900 questions.
He also enjoys writing articles to promote and explain Angular 2's specific features on his blog (https://medium.com/@ttemplier/) and on the Restlet blog (http://restlet.com/blog/author/thierry-templier/).
Thanks to Nir, Meeta, and Narsimha for taking me on board and working with me on this project. Thanks to my beloved wife and son, Séverine and Maël, for their daily support.
About the Reviewers
Robin Böhm is a Germany based passionate trainer for Angular. He is also the co-founder of the AngularJS.DE platform, which is the biggest community for Angular in Germany. Together with his team, he offers intensive workshops and trainings for web development with Angular. Since 2013, they have successfully trained over 5000 developers from freelance developers to employees of large German corporate (DAX) companies.
Daniel Zen is a MIT graduate in Computer Science Engineering and has been teaching and writing software for the past three decades. He has taught computer programming and Agile methodologies at NYU, The New School, and at numerous Fortune 500 companies. He has worked on large-scale art projects, as well as interactive installations at the Museum of Science in Boston and The Milk Gallery in NYC. A former consultant to both Google and Pivotal Labs, Zen is now focused on zen.digital, a full stack JavaScript training and consulting company.
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
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.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
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
Preface
Angular 2 is a leap forward from the previous Angular 1.x framework, which became the most popular frontend JavaScript framework in history.
It is a complete re-write, an up-to-date platform that