//组件
export class AppComponent {
title = 'my-App';
msg = 'yqq';
}
//自定义管道
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'lcUppercase'
})
export class LcUppercasePipe implements PipeTransform {
transform(value: string, args :string[]): string {
if(value == 'yqq'){
return value.toUpperCase()+'大帅哥';
}
return 'yyds';
}
}
/*视图*/
<h1>{{msg|lcUppercase}}</h1>