Change Real Angular Mask 2

Asked

Viewed 698 times

1

I have a field with value formatted with currency 'BRL':'true:'2.0-0'. The value it brings me is like this: R$ 500,000,000. I would like to know how to leave as follows: 500,000,000.

  • At the angle I use the library angular-locale-en it converts all values to the Brazilian standard, just declare the currency normally 'value | currency', the rest she does, it is also possible to change the formatting to as you wish follow the link https://github.com/renato/bower-angular-locale

1 answer

1


I advise you to use a transformation filter for your variable.

 angular.module("seuAPP").filter("nomedofiltro", function () { 
    return function (input) { 
        if (input.length <= 3) return input; 
        var output = input.substring(0,3)+ "."; 
        return output; 
    }; 
 }); 

with this function above you will include the first point, just complete the other cases when you have 7 characters and so on.

on the screen just use this way:

{{ suavariavel | nomedofiltro }}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.