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