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

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

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

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

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
某草草

First install jquery

tsd install jquery --save

or

typings install dt~jquery --global --save

Write in the header of the ts file you need to use

declare var $: any;

This way you can use jquery in your ts file

黄舟

Like it, but it is not recommended to use Jquery in angular2, it is easy to be contaminated

滿天的星座

ng2 Don’t use jquery, there is no need
If you pass the dom, just specify it #content in the template

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!