Reputation: 1269
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 https://www.npmjs.com/package/bootstrap-tokenfield
.
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.
Upvotes: 1
Views: 310
Reputation: 3207
if you want to import npm package to ember client side code you can use ember-browserify (https://github.com/ef4/ember-browserify), inside your project you can simply do
import MyCoolModule from "npm:my-cool-module";
Upvotes: 1