angular pipe의 활용

pipe 란?

angular pipe란 입력받은 데이터를 사용자가 원하는 형태로 변형시켜 출력할 수 있게 해 준다.

여러개의 pipe를 사용하기

계속해서 pipe를 나열하여 chaning 하여 사용할 수 있다.

example {% raw %}

{{  birthday | date:'fullDate' | uppercase}}

{% endraw %}

Date Pipe

example {% raw %}

<p>The hero's birthday is {{ birthday | date }}</p>
<p>The hero's birthday is {{ birthday | date:"MM/dd/yy" }} </p>

{% endraw %} 참조

Currency Pipe

{% raw %}

    <!--output '$0.259'-->
    <p>A: {{a | currency}}</p>

    <!--output 'CA$0.26'-->
    <p>A: {{a | currency:'KRW'}}</p>

    <!--output 'KRW0.26'-->
    <p>A: {{a | currency:'KRW':'code'}}</p>

    <!--output 'CA$0,001.35'-->
    <p>B: {{b | currency:'KRW':'symbol':'4.2-2'}}</p>

    <!--output '$0,001.35'-->
    <p>B: {{b | currency:'KRW':'symbol-narrow':'4.2-2'}}</p>

    <!--output '0 001,35 CA$'-->
    <p>B: {{b | currency:'KRW':'symbol':'4.2-2':'fr'}}</p>
  </div>`

{% endraw %} 참조