Filtro custom

by Alejandro M

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<div ng-app='filterExampleApp' ng-controller='FilterExampleController'>
  <p>{{text | toUpperCase}}</p>
  <p>{{text | uppercase}}</p>
  
  <!--{{ number_expression | number : fractionSize}}-->
  <p>{{value | number}}</p><!-- 3 digitos por default-->
  <p>{{value | number:0}}</p>

</div>

JavaScript

var myApp = angular.module('filterExampleApp', []);
myApp.filter('toUpperCase', function () {
  return function (text, length, end) {
    if (text) {
      return text.toUpperCase();
    }
  }
});
myApp.controller("FilterExampleController", function ($scope) {
  $scope.text = 'esto es un texto de prueba';
  $scope.value = 111.2213123
});