Directives
Angular supports three different types of directives. They are as follows:
- Components: Components are the most trivial type of directives. As described earlier in this chapter, components are classes annotated with the @Componentdecorator. They consist of metadata such asselector (name of the directive), thetemplate ortemplateUrl (for the HTML syntax), and application logic used to process the form data. The following is a sample login directive of the typeÂComponent:
        import {Component} from '@angular/core';
        import { Login } from './login';
        @Component({
selector: 'login',
template: `<div>
        <form (ngSubmit)="onSubmit()" #loginForm="ngForm">
        <input type="email"
                       class="form-control"
                       id="email"
                       placeholder="Email"
                       [(ngModel)]="model.email"
                       name="email">
        <input type="password"
                    ... 
                                             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
     
         
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                