Last active
February 13, 2019 13:01
-
-
Save unlocomqx/617df1c3d87ba0e6c82aff8cf13d4bfc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isNgElement(el) { | |
var is_ng = false; | |
Array.prototype.slice.call(el.attributes).filter(function(attr) { | |
if(/^_ng/.test(attr.name)){ | |
is_ng = true; | |
return; | |
} | |
}); | |
return is_ng; | |
} | |
function getNgElements() { | |
var elements = []; | |
Array.prototype.slice.call(document.querySelectorAll('*')).filter(function (el) { | |
if (isNgElement(el)) { | |
elements.push(el); | |
} | |
}); | |
return elements; | |
} | |
var elems = getNgElements(/^_nghost/); | |
for (elem of elems) { | |
console.log(elem); | |
elem.addEventListener('focus', (event) => { | |
console.log(ng.probe(event.target)); | |
}, true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment