Using @ViewChild in Angular

A ViewChild is a component, directive, or element as a part of a template. If we want to access a child component, directive, DOM element inside the parent component, we use the decorator @ViewChild() in Angular. To understand this, suppose we have two components, a child and a parent one. Since the child component can… Continue reading Using @ViewChild in Angular

Reusing components with Content Projection in Angular

Want to change the content inside your component and re-use them? Well, That is what we use Content Projection for, in Angular. Let us start by defining what Content Projection is. A feature with the help of which we can have a component with a kind of visual wrapper, and the content inside that wrapper… Continue reading Reusing components with Content Projection in Angular

What is a Shared Module?

In Angular, we can create different feature modules for every feature. Each one of these features would require importing the CommonModule and other imports too. Do we really want to repeat all this for every feature module? Or do we have an alternative? Yes, We can define a Shared Module. A Shared Module is used… Continue reading What is a Shared Module?

Understanding Services and Dependency Injection

We’ve all worked with Components and used component communication, but what do we do if we want to share data or logic across components? WE BUILD SERVICES. Let us try to understand what exactly services are. So, a service is basically a class, but with a focused purpose. With services, the code becomes easy to… Continue reading Understanding Services and Dependency Injection

Modules in Angular

What is an Angular Module? A class with an @NgModule decorator which organizes the pieces of an application and extend our application with capabilities from the external libraries. To start with, every angular application has a root application module, called AppModule and a root application component, called AppComponent. The AppModule bootstraps the AppComponent. Looks like… Continue reading Modules in Angular

Using Template Reference variable in Angular

In this article, we will discuss the use of a template reference variable for component communication. A template reference variable is used to give reference to a DOM Element, a component, directive, or a web component within a template. This variable can then be used anywhere inside the template. This is done using a # symbol inside… Continue reading Using Template Reference variable in Angular

REACTIVE FORMS FOR BEGINNERS

In Angular, there are two types of forms: — Template Driven Forms — Reactive Forms If you are new to forms, understand these here. In this blog post, we will learn how to create custom validators for Angular Reactive Forms. So, to start with, I assume that you have already created a project using ng new. Now, suppose we have… Continue reading REACTIVE FORMS FOR BEGINNERS