打包:ng build --prod --aot --output-hashing=all
管道
pipe官网链接
get format() { return this.toggle ? ‘shortDate’ : ‘fullDate’; }
get format()与date:format进行数据绑定
template: `
<p>The hero's birthday is {
{ birthday | date:format }}</p>
<button (click)="toggleFormat()">Toggle Format</button>
`
export class HeroBirthday2Component {
birthday = new Date(1988, 3, 15); // April 15, 1988 -- since month parameter is zero-based
toggle = true; // start with true == shortDate
get format() { return this.toggle ? 'shortDate' : 'fullDate'; }
toggleFormat() { this.toggle = !this.toggle; }
}
把一个类标记为一个管道
import { Pipe, PipeTransform } from '