本文整理匯總了TypeScript中@angular/core.PipeTransform類的典型用法代碼示例。如果您正苦於以下問題:TypeScript PipeTransform類的具體用法?TypeScript PipeTransform怎麽用?TypeScript PipeTransform使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了PipeTransform類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: value
get value() {
if (!this.row) return '';
const prop: any = deepValueGetter(this.row, this.column.prop);
const userPipe: PipeTransform = this.column.pipe;
return userPipe ? userPipe.transform(prop) : prop;
}
示例2: getCellData
/**
* @param value data to render integer
*/
getCellData(value: any) {
let parsedValue: string;
if (typeof this.pipeArguments !== 'undefined' && value !== undefined) {
parsedValue = this.componentPipe.transform(value, this.pipeArguments);
}
return parsedValue;
}
示例3: getCellData
/**
* @param value data to render integer
*/
getCellData(cellvalue: any, rowvalue?: any) {
let parsedValue: string;
if (this.componentPipe && typeof this.pipeArguments !== 'undefined' && cellvalue !== undefined) {
parsedValue = this.componentPipe.transform(cellvalue, this.pipeArguments);
} else {
parsedValue = cellvalue;
}
return parsedValue;
}
示例4: it
it('should transform html to the SafeHtml', () => {
const html = '<a href="#">foo</a>';
const sanitized = '<a href="#">sanitized</a>';
sanitizerSpy.bypassSecurityTrustHtml.and.returnValue(sanitized);
const safeHtml: SafeHtml = safeHtmlPipe.transform(html);
expect(safeHtml).toEqual(sanitized);
expect(sanitizerSpy.bypassSecurityTrustHtml).toHaveBeenCalledTimes(1);
expect(sanitizerSpy.bypassSecurityTrustHtml).toHaveBeenCalledWith(html);
});
示例5:
return () => (value: any, ...args: any[]): any => {
return pipe.transform(value, ...args);
};