From 710173314d754115b6512a60c6c477f5570b3f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Thu, 8 Aug 2019 15:54:55 +0200 Subject: [PATCH] Fix Initial Focus --- lib/focus.directive.js | 7 +++++++ src/focus.directive.ts | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/lib/focus.directive.js b/lib/focus.directive.js index 9a1c282..1e03262 100644 --- a/lib/focus.directive.js +++ b/lib/focus.directive.js @@ -269,6 +269,13 @@ exports.default = { focusElement.focus(); } }, + inserted: function (el, binding, vnode) { + if (vnode.elm) { + var focusElement = exports.navigationService.getFocusElementById(vnode.elm.id); + if (focusElement && focusElement.isFocus) + focusElement.focus(); + } + }, unbind: function (el, binding, vnode) { if (vnode.elm) { var focusElement = exports.navigationService.getFocusElementById(vnode.elm.id); diff --git a/src/focus.directive.ts b/src/focus.directive.ts index e429734..fbd86ec 100644 --- a/src/focus.directive.ts +++ b/src/focus.directive.ts @@ -294,6 +294,13 @@ export default { focusElement.focus(); } }, + inserted: (el: any, binding: any, vnode: VNode) => { + if (vnode.elm) { + let focusElement = navigationService.getFocusElementById((vnode.elm).id); + if (focusElement && focusElement.isFocus) + focusElement.focus(); + } + }, unbind: (el: any, binding: any, vnode: VNode) => { if (vnode.elm) { let focusElement = navigationService.getFocusElementById((vnode.elm).id);