Skip to content

Instantly share code, notes, and snippets.

@StephenFluin
Created September 3, 2014 15:57
Show Gist options
  • Save StephenFluin/1c992bb2f4ceae4162a8 to your computer and use it in GitHub Desktop.
Save StephenFluin/1c992bb2f4ceae4162a8 to your computer and use it in GitHub Desktop.
var paperHandler = function(event) {
if(!event.target.value) {
value = event.target.checked;
} else {
value = event.target.value;
}
$scope.$apply(function() {
$scope.workOrder[event.target.getAttribute("ng-model")] = value;
});
};
var fields = document.querySelectorAll('paper-input');
for (var i = 0; i < fields.length; ++i) {
fields[i].addEventListener('change', paperHandler);
}
fields = document.querySelectorAll("paper-checkbox");
for (var i = 0; i < fields.length; ++i) {
fields[i].addEventListener('change', paperHandler);
}
@StephenFluin
Copy link
Author

Stuff this in your controller, and change $scope.workOrder to wherever you want to put the objects.

It should be "future-compatible" because it allows you to still specify variables with ng-model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment