Skip to content

Instantly share code, notes, and snippets.

@jerkovicl
Last active April 20, 2018 18:23
Show Gist options
  • Save jerkovicl/d38a96ea02ac724454d23a58c97a7aa9 to your computer and use it in GitHub Desktop.
Save jerkovicl/d38a96ea02ac724454d23a58c97a7aa9 to your computer and use it in GitHub Desktop.
import {
Component,
Directive,
Renderer2,
ElementRef,
NgModule,
Input,
Output,
EventEmitter,
AfterContentInit,
OnInit
} from '@angular/core';
import { MatFormFieldControl } from '@angular/material';
import { AboutComponent } from '@app/about/about.component';
import { NgControl } from '@angular/forms';
@Directive({
selector: "[inputDisable]",
providers: []
})
export class InputDisableDirective implements AfterContentInit, OnInit {
@Input() inputDisable: string[]
constructor(private el: ElementRef,
private renderer: Renderer2, private ngControl : NgControl) {
//noinspection TypeScriptUnresolvedVariable,TypeScriptUnresolvedFunction
}
ngOnInit() {
this.ngControl.control.disable();
}
ngAfterContentInit() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment