import { PipeTransform, Pipe } from '@angular/core';
/**
* 将boolean类型徽章化
*
* @example
* ```html
*
|
* ```
*/
@Pipe({ name: 'yn' })
export class YNPipe implements PipeTransform {
transform(value, yes: string, no: string): string {
if (value === true) {
return '' + (yes || '是') + '';
} else {
return '' + (no || '否') + '';
}
}
}