angular 管道
生活随笔
收集整理的這篇文章主要介紹了
angular 管道
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
管道將數據作為輸入并將其轉換為所需的輸出(實現對數據的格式化)。
管道可以接受任意數量的可選參數來微調起輸出,要向管道添加參數,請使用冒號(:)跟隨管道名稱,然后使用參數值,如:date: "MM/dd/yy",如果管道接受多個參數,請用冒號分割值如:slice:1:5。
<p>The hero's birthday is {{ birthday | date:"MM/dd/yy"}}</p>birthday = new Date(1988, 3, 15);復制代碼<p>The hero's birthday is {{ birthday | date:format }}</p><button (click)="toggleFormat()">Toggle Format</button> toggle = true; // start with true == shortDate get format() { return this.toggle ? 'shortDate' : 'fullDate'; } toggleFormat() { this.toggle = !this.toggle; }復制代碼<p>The chained hero's birthday is{{ birthday | date:'fullDate' | uppercase}}</p>復制代碼轉載于:https://juejin.im/post/5c86092df265da2dde072489
總結
以上是生活随笔為你收集整理的angular 管道的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 单点登录系统SSO概述 | 单点登录讲解
- 下一篇: Flutter开发环境安装