lundi 19 septembre 2016

How to use javascript library? (Ember JS)

Simple question here, but I can't seem to figure out how to use a dependency I've installed in my ember JS app. I installed the twitter fetcher library via bower.

enter image description here

I have a twitter-container component, and inside of my component.js:

import Ember from 'ember';
export default Ember.Component.extend({
loadPlugin: function() {
    var config1 = {
      "id": 'XXXXXXXXXXXXXXX',
      "domId": 'example1',
      "maxTweets": 1,
      "enableLinks": true
    };
    twitterFetcher.fetch(config1);
  }.on('init')
});

I get a 'twitterFetcher is not defined' error (obviously), but am not sure how to import it. Should I include a line like this?

import twitterFetcher from 'bower_components/twitter-fetcher'




Aucun commentaire:

Enregistrer un commentaire