custom filter angular
reverse text
by racha440
HTML
<link rel="stylesheet" href="//cdn.jsdelivr.net/foundation/4.3.1/css/foundation.min.css">
<body ng-app="app" ng-controller="MainCtrl">
<input type="text" ng-model="originaldata">
Orginal:<h1> {{originaldata}}</h1>
Filter:<h1>{{originaldata | reversing }}</h1>
</body>
JavaScript
var app = angular.module('app', []);
app.controller('MainCtrl', function($scope) {
$scope.message = $scope.originaldata;
});
app.filter('reversing', function () {
return function (item) {
if(item!= undefined){
return item.split("").reverse().join("");
}
};
});