Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
angular2降价模块出现故障_Angular_Npm_Markdown - Fatal编程技术网

angular2降价模块出现故障

angular2降价模块出现故障,angular,npm,markdown,Angular,Npm,Markdown,我正在尝试在angular2项目中创建一个标记编辑器,为此,我在项目中安装了angular2标记模块。 不幸的是,当我试图使用它时,我有一个错误:“marked”不是一个函数。错误来自以下行: //html的复杂标记 公共编译(数据:字符串){ 返回标记(数据) } 你知道我能做些什么来解决这个问题吗 这就是我在组件中创建标记输入的方式: <textarea [(ngModel)]="textData" [ngModelOptions]="{standalon

我正在尝试在angular2项目中创建一个标记编辑器,为此,我在项目中安装了angular2标记模块。 不幸的是,当我试图使用它时,我有一个错误:“marked”不是一个函数。错误来自以下行:

//html的复杂标记

公共编译(数据:字符串){

返回标记(数据)

}

你知道我能做些什么来解决这个问题吗

这就是我在组件中创建标记输入的方式:

<textarea [(ngModel)]="textData" [ngModelOptions]="{standalone: true}">
</textarea>
<markdown [data]="textData">

我不知道降价的原因,但以下建议适用于一般角度、打字脚本和开发角度组件

<markdown [data]="textData">  --> markdown is a component selector and not a function/method in a class

return marked(data);  --> marked() is called so its expected some where its defined. so if you are expecting to be available some here in markdown library, create an object of it and then use it.

const myMarkLib = new MarkLib();
markLib.markdown();
-->标记是组件选择器,而不是类中的函数/方法
返回标记(数据);-->调用marked(),以便在其定义的某些位置使用它。所以,如果您希望可以在markdown库中找到一些,请创建一个对象,然后使用它。
const myMarkLib=新的MarkLib();
markLib.markdown();

编译函数是您创建的还是来自angular2标记模块?如果创建了该函数,请确保将在中定义标记函数的模块导入到包含编译函数的模块中。如果它是angular2 markdown的一部分,那么请确保它与它的所有依赖项一起正确安装。我的项目路径有问题,所以我只是手动c/p markdown模块。我认为导入已标记函数的模块已正确导入,因为我在执行“从“../../node_modules/marked/index”标记的导入*时没有错误。如果我尝试执行console.log以显示已标记的变量,则我有一个对象。