如何在Angular4中重新启动Pipe?
我有一个使用Pipe的组件
组件使用一些使用Pipe的数据渲染一次
一些数据已更改,管道将更改
如何重新启动管道或重新启动组件?
管道有atturibute pure
Pure and Impure Pipes
Pure Pipes没有改变(是不可变的)
Impure Pipes将被更改(可变)
@Pipe({
name: 'join',
pure: false || true
})
在angular
,pipe
可以用作pure
和impure
什么是纯净和不纯的管道?
简单来说,
impure-pipe
甚至可以更改数组项目
pure-pipe
只工作component
装载。
@Pipe({
name: 'sort',
pure: true | false // true makes it pure and false makes it impure
})
export class myPipe implements PipeTransform {
transform(value: any, args?: any): any {
return null;
}
}