Freewall: jQuery Plugin


#1

I am in need of help. I have been wasting time and racking my brain on how to load the ‘Freewall’ plugin by jQuery into my Ember app I am building. I have only been using Ember for about a week now, but I didn’t think it would be this difficult to reference a jQuery plugin to use in my app. Can anyone please help?


#2

wrapping jquery plugins that contain ember code is non-trivial, I would not advise attempting it as a beginner. Have a look on emberobserver.com for existing addons that do what you need already.


#3

Assuming you have a standard ember cli project, and that you’re just looking to import the jquery plugin rather than wrap and ‘emberize’ it, all you need to do is install and import it.

In your ember-cli-build.js file you can import bower components that you’ve installed. For items you can’t get through bower, you can drop them into your vendor folder and import them from there.

Once you import your jquery plugin, it should be available as a global to be used anywhere in your app.

For example:

// ember-cli-build.js
var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
    var app = new EmberApp(defaults, {

    });
    
    app.import('bower_components/bootstrap-sass/assets/javascripts/bootstrap.min.js');
    app.import('vendor/reCaptcha.js');
    
    return app.toTree();

};

Here’s the official docs link: https://guides.emberjs.com/v2.5.0/addons-and-dependencies/managing-dependencies/