SHARE
TWEET

Untitled

a guest Sep 12th, 2019 100 in 11 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { NgControl } from '@angular/forms';
  2. import { Directive, Input } from '@angular/core';
  3.  
  4. @Directive({
  5.   selector: '[disableControl]'
  6. })
  7. export class DisableControlDirective {
  8.   @Input() set disableControl(condition: boolean) {
  9.     const action = condition ? 'disable' : 'enable';
  10.     this.ngControl.control[action]();
  11.   }
  12.  
  13.   constructor(private ngControl: NgControl) {}
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top