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
Author: unravelweb.dev
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
Beginning with Unit Testing in Angular
Before going on to test our angular code, we need to understand what is a unit test. A Unit test is defined to be a test on a single unit,where unit can be a single class or a group of related classes. There are 2 types of tests we often talk about: – Unit Test… Continue reading Beginning with Unit Testing in Angular
Video – Binding arrays to Tables in Angular
In this video, you will learn about binding arrays to tables in Angular. Do not forget to share feedback. Thanks.
Binding Array to a Table
In this article, we will learn how to bind an array to a HTML table. This means that we want the elements in our array and their attributes to be displayed on the view. For this, we will mainly use some hard-coded data and structure directives like *ngIf and *ngFor. So, initially, if we have… Continue reading Binding Array to a Table
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