Skip to content

Instantly share code, notes, and snippets.

@leon
Created March 20, 2013 14:43
Show Gist options
  • Save leon/5205184 to your computer and use it in GitHub Desktop.
Save leon/5205184 to your computer and use it in GitHub Desktop.
Angular Copy values from form
.directive('copyValue', function($parse) {
return function(scope, element, attrs) {
if (attrs.ngModel) {
if (element[0].type === "radio") {
if (element[0].checked === true) {
$parse(attrs.ngModel).assign(scope, element.val());
}
} else {
$parse(attrs.ngModel).assign(scope, element.val());
}
}
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment