dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/library/sharedComponents/input/focus.directive.ts @ 57673
1 |
import {Directive, HostListener, Input} from "@angular/core"; |
---|---|
2 |
|
3 |
@Directive({ |
4 |
selector: '[focus-directive]', |
5 |
})
|
6 |
export class FocusDirective { |
7 |
@Input('formInput') formControl: any; |
8 |
|
9 |
constructor() { } |
10 |
|
11 |
@HostListener |
12 |
('focus', ['$event.target']) |
13 |
onFocus(target) { |
14 |
this.formControl.markAsTouched({onlySelf: true}); |
15 |
}
|
16 |
|
17 |
@HostListener('blur', ['$event.target']) |
18 |
onBlur(target) { |
19 |
this.formControl.markAsUntouched({onlySelf: true}); |
20 |
}
|
21 |
|
22 |
}
|