jeudi 3 décembre 2015

Importing NPM-installed Libraries for Usage in Ember.js

Inside my component, I have

  didInsertElement: function() {

    $('#' + this.idVal).tokenfield({
      autocomplete: {
        source: ['red','blue','green','yellow','violet','brown','purple','black','white'],
        delay: 100,
        minLength: 1,
      },
      showAutocompleteOnFocus: true
    });

I am trying to use the npm package http://ift.tt/1IHjtcS.

However, I noticed that $().tokenfield() is undefined meaning that I am not importing it properly. I tried adding it to the ember-cli-build.js but I noticed that it is probably importing bootstrap-tokenfield before jquery which causes issues. (Is this the case the ember.build.js imports those files before any dependencies?)

Am I supposed to import bootstrap-tokenfield in the component somehow if I am trying to use it with npm install?

I am using Ember 2.1.0.




Aucun commentaire:

Enregistrer un commentaire