Angular 2 Components
eBook - ePub

Angular 2 Components

Nir Kaufman, Thierry Templier

Share book
  1. 124 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Angular 2 Components

Nir Kaufman, Thierry Templier

Book details
Book preview
Table of contents
Citations

About This Book

A quick and concise guide to Angular 2 ComponentsAbout This Book‱ First look to the Angular 2 Components architecture‱ Creating your own Angular 2 Component‱ Integrating your components with third party componentsWho This Book Is ForIf you are a front-end developer with some experience in Angular and want to understand Angular 2 Components, and easily put it to use to create powerful user interfaces and views, then this book is for youWhat You Will Learn‱ Break your application into reusable dynamic components‱ Take advantage of TypeScript in Angular 2‱ Migrate your Angular 1 directive to an Angular 2 Component‱ Understand the Angular 2 component structure and APIs‱ Hook to component life cycle events‱ Bind dynamic data to your component properties‱ Communicate with other components using events‱ Compose complicated UIs from simple componentsIn DetailThis book is a concise guide to Angular 2 Components and is based on the stable version of Angular 2. You will start with learning about the Angular 2 Components architecture and how components differ from Angular directives in Angular 1. You will then move on to quickly set up an Angular 2 development environment and grasp the basics of TypeScript. With this strong foundation in place, you will start building components.The book will teach you, with an example, how to define component behavior, create component templates, and use the controller of your component. You will also learn how to make your components communicate with each other. Once you have built a component, you will learn how to extend it by integrating third-party components with it. By the end of the book, you will be confident with building and using components for your applications.Style and approachA step-by-step guide covering features and working of Angular 2 Components along with the process for creating your own components.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Angular 2 Components an online PDF/ePUB?
Yes, you can access Angular 2 Components by Nir Kaufman, Thierry Templier in PDF and/or ePUB format, as well as other popular books in Computer Science & Web Development. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781785889400
Edition
1

Angular 2 Components


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

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/).

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 availa...

Table of contents