Search code examples
jqueryjquery-pluginsaurelianotifyjs

How to use jQuery plugins with Aurelia


How do I use jquery plugins with Aurelia? In particular, I am trying to use Notify.js.

It's in my package.json under jspm -> dependencies as follows:

"notifyjs-browser": "npm:notifyjs-browser@^0.4.2"

And I have tried to import it as follows:

import { notify } from 'notifyjs-browser';

And use it like so:

$.notify("Test 123", "error");

However, I get this error message:

$.notify is not a function

I assume I will have the same issue with any jQuery plugins in Aurelia. How do I solve this?

UPDATE: It appears that the issue may only exist when using a JSPM setup as I have, as both @peinearydevelopment's answer and another answer I received for this same question on Aurelia's "discourse" page both insist notifyjs works fine with Aurelia CLI. It would be really great if I don't have to rewrite everything just to change from JSPM to Aurelia CLI. Can anyone help figure this out? Moving to Aurelia CLI seems like a lot of work for this small problem.


Solution

  • I couldn't get Notify.js to work under a JSPM setup, so I decided to find something else instead. I opted for the aurelia-notification plugin and that's working fine. I would still love to know what the issue is getting it to work under JSPM, because there are likely to be other libraries with the same problem. So if anyone has the answer, please do share.