Skip to content

Instantly share code, notes, and snippets.

@unlocomqx
Last active February 13, 2019 13:01
Show Gist options
  • Save unlocomqx/617df1c3d87ba0e6c82aff8cf13d4bfc to your computer and use it in GitHub Desktop.
Save unlocomqx/617df1c3d87ba0e6c82aff8cf13d4bfc to your computer and use it in GitHub Desktop.
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