title: Directive for validation the input value
body: <p>I created the directive for validating the input value. I need that on input some characters my input/form become ivalid. 
  Here is my code, but it is not working. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import {Directive, Input} from '@angular/core';
  import {AbstractControl, NG_VALIDATORS, ValidationErrors} from '@angular/forms';
  
  const regExp = new RegExp('(&gt;|&lt;)+');
  
  @Directive({
      selector: '[validator]',
      providers: [{
          provide: NG_VALIDATORS,
          useExisting: ValidatorDirective,
          multi: true
      }]
  })
  
  export class ValidatorDirective {
      @Input('validator') input;
  
      constructor() {
  
      }
  
      validate (control: AbstractControl): ValidationErrors {
          const value = control.value;
          const isValid = regExp.test(value);
  
          return isValid ? null : {
              validator: {
                  valid: false
              }
          };
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thank you for your help.
  Have a nice day.</p>