Seperate electron and web target building
This commit is contained in:
committed by
József Farkas
parent
517aed1b1c
commit
983eb72892
21
shared/src/directives/cancelable/cancelable.directive.ts
Normal file
21
shared/src/directives/cancelable/cancelable.directive.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Directive, ElementRef, HostListener, Renderer } from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[cancelable]'
|
||||
})
|
||||
export class CancelableDirective {
|
||||
|
||||
private originalValue: string;
|
||||
|
||||
constructor(private elementRef: ElementRef, private renderer: Renderer) { }
|
||||
|
||||
@HostListener('focus') onFocus(): void {
|
||||
this.originalValue = this.elementRef.nativeElement.value;
|
||||
}
|
||||
|
||||
@HostListener('keyup.escape') onEscape(): void {
|
||||
this.renderer.setElementProperty(this.elementRef.nativeElement, 'value', this.originalValue);
|
||||
this.renderer.invokeElementMethod(this.elementRef.nativeElement, 'blur');
|
||||
}
|
||||
|
||||
}
|
||||
1
shared/src/directives/cancelable/index.ts
Normal file
1
shared/src/directives/cancelable/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { CancelableDirective } from './cancelable.directive';
|
||||
1
shared/src/directives/index.ts
Normal file
1
shared/src/directives/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './cancelable';
|
||||
Reference in New Issue
Block a user