angular2-markdown模块失败

时间:2017-06-15 20:28:34

标签: angular npm markdown

我正在尝试在angular2项目中的表单中创建一个markdown编辑器,为了做到这一点,我在我的项目中安装了angular2-markdown模块。 不幸的是,当我尝试使用它时,我有这个错误:"标记为"不是一个功能。错误来自这些方面:

  

//对HTML进行补充标记

     

public compile(data:string){

     

返回标记(数据);

     

}

您知道我该怎么做才能解决问题吗?

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

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

1 个答案:

答案 0 :(得分:1)

我不知道降价,但以下建议是针对一般角度,打字稿和开发角度分量。

<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();
相关问题