1

So I'm pretty much having the exact problem listed here: Using jquery in Ember-cli

But I've already done the following as recommended in the thread above:

Added:

app.import('bower_components/jquery-ui/jquery-ui.js');
app.import('bower_components/jquery-ui/ui/tooltip.js');

Changed

Ember.$(selector).tooltip();

to

this.$(selector).tooltip();

Ember isn't recognizing the tooltip function as being defined despite UI being installed and doing the above.

Error:

Uncaught TypeError: undefined is not a function

Any help?

2
  • 1
    You added the import to the brocfile right? and Ember.$ should work just fine Commented Nov 19, 2014 at 21:01
  • @PatsyIssa Yeah, I did and before the export as one should. I've seen both -- people have said that for views and components that you should use this.$ but neither works... :\ Commented Nov 19, 2014 at 22:36

2 Answers 2

5

A few things. First, jquery-ui.js is the entire jQuery UI library. So, you've already got tooltip in there. Remove that second line.

If you only want the tooltip, you'll need to import core, widget and position separately (reference), and then the tooltip.

Finally, you probably want to include a theme. The default one lives here:

app.import('bower_components/jquery-ui/themes/smoothness/jquery-ui.min.css');

With that, stick the this.$().tooltip() in your view's didInsertElement callback and you should be good to go.

Sign up to request clarification or add additional context in comments.

7 Comments

Still saying it's undefined. I'm at a loss for words... I appreciate your willingness to help me though.
Did you just try this.$().tooltip()? i.e. don't put a string in for selector
Good catch! I just changed that but it's still saying it's undefined. I can see the imports in my vendor.js file, but I cannot find any of the definitions (i.e. tooltip) in the global namespace when using the browser inspector. It makes no sense to me
I can see it defined in the UI js file here: var tooltip = $.widget( "ui.tooltip", { version: "1.11.2", options: { I just don't understand why it cannot find it...
have you restarted ember server?
|
0

The problem was I had imported Ember Data which was causing an error (apparently it's imported by default or the options were stated incorrectly). Once I removed that, UI is now working properly.

Thank you for all your help Sam!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.