angular.js - angular2如何使用jquery等插件?
PHP中文网
PHP中文网 2017-05-15 17:08:46
0
3
760

如何在angular2里面使用jquery等插件
比如:
class MyComponent {

constructor() {
    // how to query the DOM element from here?
}

}
虽然看过几个答案,但是没看明白,自己动手也都失败了,求教

PHP中文网
PHP中文网

认证高级PHP讲师

Antworte allen(3)
某草草

首先安装jquery

tsd install jquery --save

或者

typings install dt~jquery --global --save

在需要使用的ts文件头部中写

declare var $: any;

这样在你的该 ts 文件中就可以使用jquery了

黄舟

赞一个,不过angular2中应该不建议使用Jquery,容易被污染

滿天的星座

ng2 就不要使用 jquery 了,没必要
传 dom 的话直接在 template 指定 #content 就行

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!