1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Custom directive to convert percent

Discussão em 'Angular' iniciado por user4208442, Novembro 7, 2024 às 11:02.

  1. user4208442

    user4208442 Guest

    I am trying to create a custom directive in Angular 2 which will change the value of an input ngModel to percent for example

    number / 100


    [​IMG]

    This is an example image of what I am trying to achieve.

    For example, the user sees the 5.12, but the value which will be sent to the backend should be 5.12 / 100, and the user shouldn't see this.

    I have come to an approach, but, I think, that is a wrong approach, can you guys help me out?

    This is my code.

    For example, when it comes from backend to be multiplied by 100, and when it goes to backend to be divided by 100.

    Continue reading...

Compartilhe esta Página