【发布时间】:2020-01-11 13:06:41
【问题描述】:
我正在使用 Angular 8.2.4。我下载了 npm 模块 write-good。当我尝试在我的测试组件中使用时,我收到错误 ERROR ReferenceError: match is not defined。 这是组件代码。
import { Component, OnInit } from '@angular/core';
import * as writeGood from 'write-good';
@Component({
selector: 'app-textnpm',
templateUrl: './textnpm.component.html',
styleUrls: ['./textnpm.component.css']
})
export class TextnpmComponent implements OnInit {
testString: string;
constructor() { }
ngOnInit() {
this.hello();
}
public hello() {
this.testString = writeGood('so so the cat was stolen.');
}
}
以下是错误详情,
ERROR ReferenceError: match is not defined
at Object.push../node_modules/weasel-words/weasel.js.module.exports [as fn] (weasel.js:40)
at write-good.js:101
at Array.forEach (<anonymous>)
at writeGood (write-good.js:97)
at TextnpmComponent.hello (textnpm.component.ts:18)
at TextnpmComponent.ngOnInit (textnpm.component.ts:14)
at checkAndUpdateDirectiveInline (core.js:31909)
at checkAndUpdateNodeInline (core.js:44366)
at checkAndUpdateNode (core.js:44305)
at debugCheckAndUpdateNode (core.js:45327)
【问题讨论】:
标签: javascript angular typescript