Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Learning Angular, Fourth Edition
  • Toc
  • feedback
Learning Angular, Fourth Edition

Learning Angular, Fourth Edition

By : Aristeidis Bampakos, Pablo Deeleman
4.7 (32)
close
Learning Angular, Fourth Edition

Learning Angular, Fourth Edition

4.7 (32)
By: Aristeidis Bampakos, Pablo Deeleman

Overview of this book

As Angular continues to reign as one of the top JavaScript frameworks, more developers are seeking out the best way to get started with this extraordinarily flexible and secure framework. Learning Angular, now in its fourth edition, will show you how you can use it to achieve cross-platform high performance with the latest web techniques, extensive integration with modern web standards, and integrated development environments (IDEs). The book is especially useful for those new to Angular and will help you to get to grips with the bare bones of the framework to start developing Angular apps. You'll learn how to develop apps by harnessing the power of the Angular command-line interface (CLI), write unit tests, style your apps by following the Material Design guidelines, and finally, deploy them to a hosting provider. Updated for Angular 15, this new edition covers lots of new features and tutorials that address the current frontend web development challenges. You’ll find a new dedicated chapter on observables and RxJS, more on error handling and debugging in Angular, and new real-life examples. By the end of this book, you’ll not only be able to create Angular applications with TypeScript from scratch, but also enhance your coding skills with best practices.
Table of Contents (17 chapters)
close
15
Other Books You May Enjoy
16
Index

Injecting services in the component tree

The @Component decorator has a providers property similar to the @NgModule decorator to register services with a component injector. A service that registers with the component injector can serve two purposes:

  • It can be shared with its child components
  • It can create multiple copies of the service every time the component that provides the service is rendered

In the following sections, we’ll learn how to apply each approach.

Sharing dependencies through components

A service provided through the component injector can be shared among the child components of the parent component injector, and it is immediately available for injection at their constructors. Child components reuse the same instance of the service from the parent component. Let’s walk our way through an example to understand this better:

  1. Create a new component named favorites inside the src\app\products...
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete