【发布时间】:2017-02-15 11:43:09
【问题描述】:
我正在尝试使用管道内的打字稿将数字值转换为角度 2 中的字符串。它抱怨
类型字符串不能分配给类型编号
。我的管道如下。
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'pxsuffix'
}) export class pxsuffix implements PipeTransform {
transform(input: number): number {
if ((input > 0)) {
input = input.toString(),
}
return (
input = input + 'px',
);
}
}
【问题讨论】: