问题在库中,因此更改代码
input-trim.directive.ts
private updateValue(event: string, value: string): void {
const currentValue = this.trim !== '' && event !== this.trim ? value : value.trim();
const previousValue = this._value;
let trimmedPreviousValue = '';
if (Boolean(previousValue)) {
trimmedPreviousValue = previousValue.trim();
}
this.writeValue(currentValue);
const trimmedValue = this._value.trim();
if (trimmedValue !== previousValue && (trimmedValue !== '' || trimmedPreviousValue !== '')) {
this.onChange(this._value);
}
}