Which element has the focus on handling ng-blur

Which element has the focus on handling ng-blur



I'm trying to figure out how to get the activeelement | element with focus when handling the ng-blur event. I've tried window.document.activeElement but it is always 'body'.


ng-blur


window.document.activeElement


<body>
<div name="element1" ng-blur="$ctrl.onBlur($event)">element1</div>
<div name="element2" ng-blur="$ctrl.onBlur($event)">element2</div>
</body>


public onBlur($event: any): void
var value = $event.target.attributes["name"].value;
// value is the name of the element where the event is triggered
// but how to get the element to where the focus has gone to?



Fixed it using the $timeout service.


$timeout


public onBlur($event: any): void
this.$timeout(() =>
if (this.$window.document.activeElement)
// do things

, 1);





100 is too much. try with 0, 1 or 2 You should get the same result
– AdityaParab
Aug 29 at 11:58





Yep, 1 works just as well. Changed my question.
– Ralf de Kleine
Aug 29 at 12:39




1 Answer
1



Fixed it using the $timeout service.


public onBlur($event: any): void
this.$timeout(() =>
if (this.$window.document.activeElement)
// do things

, 1);






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ

Node.js puppeteer - Use values from array in a loop to cycle through pages