Skip to content

Instantly share code, notes, and snippets.

@stuf
Last active August 29, 2015 14:15
Show Gist options
  • Save stuf/767e94915f9c1db7ad17 to your computer and use it in GitHub Desktop.
Save stuf/767e94915f9c1db7ad17 to your computer and use it in GitHub Desktop.
.run(function () {
var d = document.querySelectorAll('input[type="text"]');
for (var i = d.length; i-- > 0;) {
var e = d[i];
if (e.hasAttribute('ng-model') && this.value != null && this.value != 0) {
var model = this.getAttribute('ng-model');
if (!(model === 'selectedProduct' || model === 'selectedVariation')) {
e.setAttribute('ng-init', (e.getAttribute('ng-model') + ' = "' + this.value + '"'));
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment