Using jquery in Ember-cli

前端 未结 3 2189
半阙折子戏
半阙折子戏 2020-12-19 23:17

I am relatively new to both Ember.js and Ember-cli and would really appreciate some help please with using a jquery tooltip in a custom view. All code is below, but when my

相关标签:
3条回答
  • 2020-12-19 23:19

    There are some issues in the code but just regarding error, Its coz you need to import the tooltip library(js file) into ember-cli. It is done in brocfile.js before calling app.toTree() like below

    app.import('vendor/tooltip.js');

    Follow the link for more details. http://www.ember-cli.com/#managing-dependencies

    0 讨论(0)
  • 2020-12-19 23:23

    Solved as follows:

    • Jquery's widgets etc. are not included in the standard jquery library which ember-cli uses. It has to be added using bower install --save jquery-ui
    • You then have to add the following lines to Brocfile.js:

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

    • As @Leeft pointed out, when referencing jQuery from a view or component this.$() should be used, not Ember.$()
    • Be sure to use a version of Ember-CLI after 0.40.
    0 讨论(0)
  • 2020-12-19 23:26

    Try ember-cli tool-tipster.....works great.

    0 讨论(0)
提交回复
热议问题