Closed GetTaxSolutions closed 6 years ago
Hi @GetTaxSolutions
Try this.
//after installing script-loader for webpack and after that instead of doing import * as $ from jQuery
require('script!jQuery');
Or you can try this:
import * as $ from 'jQuery';
window['$'] = $;
And also ensure that this import or require is only at one place in your application like vendor.ts
The integration looks ok now.
Hello,
We want to add ngx-owl-carousel (https://github.com/mujtaba01/ngx-owl-carousel) in the universal .net angular project -
https://github.com/MarkPieszak/aspnetcore-angular2-universal
. The project using webpack build system. The module in this project require jQuery and I started to implement in with follow steps:new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' })
npm install owl.carousel "ngx-owl-carousel --save
@import "~owl.carousel/dist/assets/owl.carousel.css"; @import "~owl.carousel/dist/assets/owl.theme.default.css";
import { OwlModule } from 'ngx-owl-carousel'; ..... @NgModule({ imports: [ ........ , OwlModule ]);
We expect to see carousel module but the result is
Obviously it doesn't find the jQuery. But when I'm trying to use in some of our components
@import * as $ from 'jQuery'
and invoke $(selector), it's there. Why OwlModule doen't find it? Is my implementation correct or doing something wrong?We want to use exact owl-carousel because migrating old product from angular 1.0 to 5.0 using your universal project. I know that adding of jQuery in Angular is not good practice but I didn't found package of owl-carousel without jQuery but have to migrate old code faster. If you can give me better advise how to do it most intelligent I will be very happy, I'm beginner with angular 5 and have some confusions yet. Will wait for your help and advises.
Thank you very much, GetTaxSolutions team.