Macro name select

Closes #208
This commit is contained in:
Farkas József
2016-12-03 20:22:32 +01:00
parent 37125af47a
commit f887dc8a96

View File

@@ -1,5 +1,5 @@
import {
ChangeDetectionStrategy, Component, ElementRef, Input, OnChanges, Renderer,
AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, Renderer,
ViewChild
} from '@angular/core';
@@ -16,16 +16,16 @@ import { AppState } from '../../../store/index';
styles: [require('./macro-header.component.scss')],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MacroHeaderComponent implements OnChanges {
export class MacroHeaderComponent implements AfterViewInit {
@Input() macro: Macro;
@Input() isNew: boolean;
@ViewChild('macroName') macroName: ElementRef;
constructor(private store: Store<AppState>, private renderer: Renderer) { }
ngOnChanges() {
ngAfterViewInit() {
if (this.isNew) {
this.renderer.invokeElementMethod(this.macroName.nativeElement, 'focus', []);
this.renderer.invokeElementMethod(this.macroName.nativeElement, 'select', []);
}
}