简体   繁体   English

在Angular2上安装draw2D touch

[英]Installation of draw2D touch on Angular2

how can I install the draw2d touch library on Angular 2 ? 如何在Angular 2上安装draw2d touch库? I do not find any news about it. 我找不到任何新闻。

Thank you 谢谢

I used the npm package listed here: https://www.npmjs.com/package/draw2d-wrapper 我使用了此处列出的npm软件包: https : //www.npmjs.com/package/draw2d-wrapper

My project was an Angular4 project built from using angular cli. 我的项目是使用angular cli构建的Angular4项目。 I added the require statement in the lib.ts file as shown in the readme. 如自述文件所示,我在lib.ts文件中添加了require语句。 Then within the xxx.component.ts file I again followed the readme and added this statement: 然后在xxx.component.ts文件中,我再次遵循自述文件并添加了以下语句:

let draw2d = (<any>window).draw2d;

This allowed me access to the draw2d library. 这使我可以访问draw2d库。

You can install using either npm or bower. 您可以使用npm或bower安装。

You can put the library's files in the scripts section of your angular-cli.json. 您可以将库的文件放在angular-cli.json的脚本部分中。 In your component you can write: 在您的组件中,您可以编写:

declare var draw2d:any;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM