AngularJS Example: Value Copy

HTML

<div id="ng-app" class="ng-app:Users" ng-controller="UserEntity">
        
    
<input type="hidden" ng-model="RegistrationDate" value="123456" mp-value-copy/>

<input type="text" ng-model="UserName" value="Adam" mp-value-copy/>


    <hr/>
    
    {{RegistrationDate}} <br/>
    {{UserName}}
</div>

CSS

</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> 
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script>
<style>

JavaScript

angular.module('SharedDirectives', [])
    .directive('mpValueCopy', 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());
                }
            }
        };
    });

    var app = angular.module('Users', ['SharedDirectives']);
   
    function UserEntity($scope) {              
        
    }