Как подключить и безболезненно юзать JQuery в пачке Angular2 / Webpack?
Пытаюсь делать так:
import { Component, OnInit } from '@angular/core';
declare var $: any;
@Component({
selector: 'catalog',
templateUrl: './catalog.component.html',
styleUrls: ['./catalog.component.scss']
})
export class CatalogComponent implements OnInit {
public products: any;
constructor(){ }
interface JQuery extends CatalogComponent {
public carousel(): any;
}
ngOnInit(){
this.products =
[
{
"id":"id-1,
"title": "Product 1",
"description": "Product One Description",
"price": 68720,
"quantity": " "
},
{
"id":"id-2,
"title": "Product 2",
"description": "Product Two Description",
"price": 68720,
"quantity": " "
},
{
"id":"id-3,
"title": "Product 3",
"description": "Product Three Description",
"price": 68720,
"quantity": " "
},
];
//Carousel
$('.multi-item-carousel').carousel({
interval: false
});
$('.multi-item-carousel .item').each(function(){
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
if (next.next().length>0) {
next.next().children(':first-child').clone().appendTo($(this));
} else {
$(this).siblings(':first').children(':first-child').clone().appendTo($(this));
}
});
}
}
Консоль в ответ делает так: