How do I call an Angular 2 pipe with multiple arguments?

后端 未结 5 1464
北海茫月
北海茫月 2020-11-27 10:50

I know I can call a pipe like this:

{{ myData | date:\'fullDate\' }}

Here the date pipe takes only one argument. What is the syntax to call

5条回答
  •  囚心锁ツ
    2020-11-27 11:32

    You're missing the actual pipe.

    {{ myData | date:'fullDate' }}
    

    Multiple parameters can be separated by a colon (:).

    {{ myData | myPipe:'arg1':'arg2':'arg3' }}
    

    Also you can chain pipes, like so:

    {{ myData | date:'fullDate' | myPipe:'arg1':'arg2':'arg3' }}
    

提交回复
热议问题