Skip to content
Advertisement

how to convert numbers to million in javascript

As in image. for some values converting correctly but some of values not converting… you can see in image

I want to convert numbers to million.I am using Money format function to convert numbers but i am unable to convert numbers.

This is controller part.for some numbers it is converting to millions and for some numbers it is not converting.. Please someone help.

JavaScript

Here I am converting numbers by using Moneyformat. This is controller part where I am converting numbers

JavaScript

Advertisement

Answer

I have no idea what $scope.MoneyFormat is.

So I simplified your function to a plain old js function and it works.

JavaScript

JSFiddle: https://jsfiddle.net/r5ju34ey/

Advertisement