Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta name="description" content="Camp NG Example 0" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-sanitize.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-controller="main">
  {{text}}
  <textarea upper-case ng-model="text"></textarea>
  
</body>
</html>
 
var app = angular.module("app", ["ngSanitize"]);
 
app.controller("main", function($scope) {
    $scope.text = "small things";
    $scope.alertHi = function() { alert("hi!"); };
});
app.directive("upperCase", function($sce){
    return {
    require: "ng-model",
    link: function(scope, element, attrs, modelCtrl) {
      modelCtrl.$formatters.push(function(value) {
        return value.toLowerCase();
      });
      modelCtrl.$parsers.push(function(value) {
        return value.toUpperCase();
      });        
    }
  };
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
gaslightpro
0viewers