mardi 22 septembre 2015

Ember dependencies "Uncaught TypeError: $(...).fitText is not a function"

I'm attempting to use a plugin (in this case 'fitText') in an Ember project.

In the ember-cli-build.js (that replaced the Brocofile recently...) - I import the dependency (which I have already installed with bower).

/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    // Add options here
  });

  app.import('bower_components/fittext/fittext.js');

  return app.toTree();
};

In my console, I can type in 'fitText' and I DO get the object back.

So, it's global now, and I should be able to use it anywhere.

In my case / I'm using it in the routes/index.js - and I've also tried it in the app.js and a few other places... but this is what I recieve in the console "Uncaught TypeError: $(...).fitText is not a function"

I've done this many times in other projects, so - I'm confused... I thought I needed to import it in the place I want to use it - but the docs don't reference that anymore.

I've put it in the ready hook in app.js - next to silimar jQuery things that work fine...

Any ideas what I'm doing wrong? Seems so simple...

$('#js_fit').fitText(1.2, { minFontSize: '20px', maxFontSize: '150px' });




Aucun commentaire:

Enregistrer un commentaire