Skip to content

Instantly share code, notes, and snippets.

@manuelbieh
Last active October 29, 2015 13:24
Show Gist options
  • Save manuelbieh/dba5f6f35ed0dfa77730 to your computer and use it in GitHub Desktop.
Save manuelbieh/dba5f6f35ed0dfa77730 to your computer and use it in GitHub Desktop.
Change all ng-* attributes to data-ng-*
Array.from(document.querySelectorAll('*')).forEach((el) => {
Array.from(el.attributes).forEach((attrib) => {
if(attrib.localName.startsWith('ng-')) {
el.setAttribute(`data-${attrib.localName}`, attrib.value);
el.removeAttribute(attrib.localName);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment