angularjs - directive upcase

How to write a "upcase" directive in angularjs

by Freewind

HTML

<html ng-app="MyApp">
    <body>
    <div ng-controller='MyCtrl'>
        <input type="text" upcase="name" />
    </div>
    </body>
</html>

CSS

</style>
<script src="http://code.angularjs.org/angular-1.0.0rc10.js"></script>
<style>

JavaScript

var app = angular.module('MyApp', []);

// this directive will upcase the value of ng-model
app.directive('upcase', function() {
    return function(scope, element, attrs) {
        var x = scope.$eval(attrs.upcase).toUpperCase() +'!!'
        element.val(x);
    };
});

app.controller('MyCtrl', ['$scope', function($scope) {
    $scope.name = 'freewind';
}]);