npx ember-component-jquery this-jquery path/of/files/ or/some**/*glob.js
# or
yarn global add ember-component-jquery
ember-component-jquery this-jquery path/of/files/ or/some**/*glob.js
Input (with-import.input.js):
import $ from 'jquery';
import Component from '@ember/component';
export default Component.extend({
didInsertElement() {
$(window).on('load', () => console.log('loaded'));
this.$().css('background', 'red');
this.$('input').focus();
},
});
Output (with-import.output.js):
import $ from 'jquery';
import Component from '@ember/component';
export default Component.extend({
didInsertElement() {
$(window).on('load', () => console.log('loaded'));
$(this.element).css('background', 'red');
$('input', this.element).focus();
},
});
Input (without-import.input.js):
import Component from '@ember/component';
export default Component.extend({
didInsertElement() {
this.$().css('background', 'red');
this.$('input').focus();
},
});
Output (without-import.output.js):
import $ from 'jquery';
import Component from '@ember/component';
export default Component.extend({
didInsertElement() {
$(this.element).css('background', 'red');
$('input', this.element).focus();
},
});