【发布时间】:2019-09-12 05:40:30
【问题描述】:
我正在使用 Angular 4,我想在我的应用程序中使用 JsTree。我将 JsTree 集成到我的 Angular 应用程序中,就像在这个答案中一样:How to add jstree to angular 2 application using typescript with @types/jstree
当我运行ng serve 时出现以下错误
ERROR in D:/VsCodeProjects/float-client/src/app/dashboard/budget-setup/budget-setup.component.ts (27,15): Property 'jstree' does not exist on type 'JQuery<HTMLElement>'.
ERROR in D:/VsCodeProjects/float-client/src/app/dashboard/budget-setup/budget-setup.component.ts (27,15): Property 'jstree' does not exist on type 'JQuery<HTMLElement>'.
在component.ts中
ngOnInit() {
$('#foo').jstree();
}
在component.html中
<div id="foo">
<ul>
<li>Root node 1
<ul>
<li>Child node 1</li>
<li><a href="#">Child node 2</a></li>
</ul>
</li>
</ul>
</div>
jstree 是否仍然支持 Angular 4?如果支持,我在这里缺少什么?
【问题讨论】:
-
请检查这个:- medium.com/@NetanelBasal/…
-
已经安装@types/jquery