提交 f2507562 编写于 作者: E Eugene Pankov

force autofocus in rename-tab modal (fixes #484)

上级 6a821fa6
.modal-body
input.form-control(type='text', [(ngModel)]='value', (keyup.enter)='save()', autofocus)
input.form-control(type='text', #input, [(ngModel)]='value', (keyup.enter)='save()', autofocus)
.modal-footer
button.btn.btn-outline-primary((click)='save()') Save
......
import { Component, Input } from '@angular/core'
import { Component, Input, ElementRef } from '@angular/core'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
@Component({
......@@ -7,11 +7,18 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
})
export class RenameTabModalComponent {
@Input() value: string
@ViewChild('input') input: ElementRef
constructor (
private modalInstance: NgbActiveModal
) { }
ngOnInit () {
setTimeout(() => {
this.input.nativeElement.focus()
})
}
save () {
this.modalInstance.close(this.value)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册