how to use jquery in angular 2?

前端 未结 2 1860
北恋
北恋 2021-01-20 23:06

I know if i I need to use 3rd party library in angular 1.3 or 1.4 .I need to make directive of that thing and use that in our project .Now I am using angular 2.0

2条回答
  •  臣服心动
    2021-01-20 23:55

    If you don't care about jQuery typings, you can just declare $:

    import {Component, ElementRef,Directive, EventEmitter,Output} from 'angular2/core';
    
    declare var $: any;
    

    If you're looking for typings, you can follow this post:

    using jQuery globaly within angular 2 application

提交回复
热议问题