JSFiddle - React, Tailwind, and code Playground
by ganarajpr
HTML
<div ng-controller="Ctrl">
<input type="text" ng-model="price">
<span>{{price | myfilter:"percent"}}</span>
</div>
JavaScript
var myModule = angular.module('myApp',[]);
myModule.filter('myfilter', function() {
return function(input, choice) {
if(input)
{
var out = "";
if (choice === "dollar") {
out = "$"+input;
}
else if(choice ==="percent"){
out = input + "%";
}
}
return out;
}
});
function Ctrl ($scope) {
};