I've got a requirement such that for certain type of scope variables, I want to keep two decimal places in AngularJs. For this I've done the following:
html
<span floatval="{{someVariable}}">{{someVariable}}</span> js
var app = angular.module('app',[]).directive('floatval', function(){ return function(scope, element, attrs){ var newInt = parseFloat(attrs.floatval); var n = newInt.toFixed(2); } }); I'm stuck here as I dont know how to now reflect this new value in the place of the original scope {{somevariable}}