如何在 Angular4 中重新初始化管道
How to reinit Pipe in Angular4
如何在 Angular4 中重新初始化管道?
我有一个使用管道的组件
Component render once with some data which use Pipe
部分数据已更改,管道将更改
如何重新初始化管道或重新初始化组件?
管道有属性pure
Pure and 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;
}
}
Click for awsome Demo Here
如何在 Angular4 中重新初始化管道?
我有一个使用管道的组件
Component render once with some data which use Pipe
部分数据已更改,管道将更改
如何重新初始化管道或重新初始化组件?
管道有属性pure
Pure and 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;
}
}