0
点赞
收藏
分享

微信扫一扫

Angular 自定义管道

//组件
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>

Angular 自定义管道_html


举报

相关推荐

0 条评论