What is a directive in Angular?

In Angular, a directive is used to expand the syntax and functionality of a standard HTML view. The Angular compiler understands Angular directives because they have a specific meaning. When Angular compiles the TypeScript, CSS, and HTML files into a single JavaScript file, it checks for directives that have been registered across the code. If a match is found, the compiler adjusts the HTML display accordingly.

Many directives are included with Angular. We can, however, create our directives and tell Angular what they do so that the compiler is aware of them and may utilize them throughout the compilation process.