I have an Aurelia app and in app.js I want to use jQuery.
So my config.js looks like:
System.config({
...
map: {
...
"jquery": "npm:[email protected]",
...
}
}
And in app.js I import the jQuery like this:
var $ = require('jquery');
But when I require it, I get the blank site. Same it was with import:
import $ from 'jquery';
What is wrong?
Thanks
EDIT: ok, solved. The problem is, the jQuery code must be called inside the attached() mehtod. So like this:
export class Class1 {
attached() {
//jQuery code here
}
}
You need to install jquery from https://github.com/components/jquery
But if you use aurelia-skeleton, you can import it from bootstrap
import 'bootstrap';
and then use $
everywhere in app, or
import $ from 'bootstrap'
Same is for jqueryui. If needed get it from https://github.com/components/jqueryui
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With