<!DOCTYPE html>
<html>
<script src="http://www.sargonco.com/Uploads/Public/article/webdistut/javascript/angular.min.js"></script>
<body>


<div ng-app="myApp">
Convert the number 255, using a custom made service inside a custom made filter:

<h1>{{255 | myFormat}}</h1>

</div>

<script>
var app = angular.module('myApp', []);
app.service('hexafy', function() {
    this.myFunc = function (x) {
        return x.toString(16);
    }
});
app.filter('myFormat',['hexafy', function(hexafy) {
    return function(x) {
        return hexafy.myFunc(x);
    };
}]);

</script>

</body>

</html>

Convert the number 255, using a custom made service inside a custom made filter:

{{255 | myFormat}}