Angular

How to Create & Use Custom Directive In Angular

In this tutorial, we will show you how to create a Custom Directive in Angular. The Angular directives help us to extend or manipulate the DOM. We can change the appearance, behavior, or layout of a DOM element using the directives. We will build a four directive example s and show you how to Create a custom directive using the
@Directive decorator. We will create both custom attribute directive & custom Structural directive. How to setup selectors. Pass value to it using the @input. How to respond to user inputs, Manipulate the DOM element (Change the Appearance) etc.

How to Create & Use Custom Directive In Angular Read More »

Ng-Content & Content Projection in Angular

In this guide let us explore how to use ng-content to add external content in the Template. We know how to use @Input decorator to pass data to a component. But it is only limited to data and not to the content which includes the HTML elements, CSS, etc, By using the ng-content we can pass the content to a child component. This is also called content projection. The ng-content provides the selector attribute, which allows us to create slots and send different content to each slot.

Ng-Content & Content Projection in Angular Read More »

Scroll to Top