Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Angular 2 Components

You're reading from   Angular 2 Components Practical and easy-to-follow guide to Angular 2 Components

Arrow left icon
Product type Paperback
Published in Nov 2016
Publisher Packt
ISBN-13 9781785882340
Length 124 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Nir Kaufman Nir Kaufman
Author Profile Icon Nir Kaufman
Nir Kaufman
Thierry Templier Thierry Thierry Templier Thierry
Author Profile Icon Thierry Templier Thierry
Thierry Templier Thierry
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Angular 2 Component Architecture 2. Setting Up an Angular 2 Development Environment with angular-cli FREE CHAPTER 3. The TypeScript Primer 4. Building a Basic Component 5. Building Dynamic Components 6. Component Communication 7. Putting It All Together 8. Integrating Third-Party Components 9. Angular 2 Directives Index

Chapter 4. Building a Basic Component

At its core, an Angular 2 component is a class that is responsible for exposing data to the view and implementing user interaction logic. An Angular 2 component can be compared to the controller, scope, and view of Angular 1.

How does Angular 2 know how to treat our class as a component? We need to attach metadata to the class to tell Angular how to treat it.

The term metadata describes the additional information that we add to our code. This information is used by Angular 2 at runtime.

In this chapter, we will cover the following topics:

  • The anatomy of an Angular 2 component
  • The component selector
  • Component template
  • Component style
  • View encapsulation (the shadow DOM)
  • Data binding
  • Anatomy of an Angular 2 component

In Chapter 2, Setting Up an Angular 2 Development Environment with angular-cli, setting the development environment, we generated an Angular 2 project from scratch using the angular-cli tool and served it to the browser. If you haven't...

lock icon The rest of the chapter is locked
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Angular 2 Components
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon