How to use jQuery UI with Angular 2

前端 未结 5 2196
旧巷少年郎
旧巷少年郎 2020-12-06 01:18

Because I want to incorporate Drag and Drop functionality in my app, I decided to import jQuery UI to my Angular 2 project.

First I started by importing jQuery itse

5条回答
  •  一向
    一向 (楼主)
    2020-12-06 02:13

    It's possible the element you're selecting isn't available yet, so the selector is failing to find the element.

    You should probably call the .draggable() in the ngAfterViewInit lifecycle hook (which is like ngOnInit) to make sure the DOM element is present before attaching.

提交回复
热议问题