Created
September 3, 2014 15:57
-
-
Save StephenFluin/1c992bb2f4ceae4162a8 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
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.