componentInstance.$
Application.rootElement
andApplicationInstance.rootElement
are "jQuery-compatible selectors".- Acceptance test helpers (
click
and friends) accept arbitrary jQuery selectors. View.appendTo
,replaceIn
,findElementInParent
accept jQuery selectors (I think this are is entirely legacy).- All event handlers receive jQuery-wrapped events, not native browser events.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import computed, { equal } from 'ember-computed'; | |
export default Ember.Component.extend({ | |
tagName: '', | |
didRender() { | |
// show classes in DOM for debug purposes | |
$('body > .my-debug').remove(); | |
$('body').append(`<div class="my-debug">${$('button').attr('class')}</div>`); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { helper } from 'ember-helper'; | |
import $ from 'jquery'; | |
export default helper(function([selector, handler]) { | |
return function(event) { | |
if ($(event.target).is(selector) && handler) { | |
return handler(event); | |
} | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
dataPoints: [ | |
{ id: 0, start: 1, end: 10 }, | |
{ id: 1, start: 8, end: 20 }, | |
{ id: 2, start: 25, end: 30 } | |
], | |
lowerLimit: Ember.computed('dataPoints.[]', function() { | |
return Math.min(...this.get('dataPoints').mapBy('start')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Install these packages from melpa: tide, company | |
;; You also need `npm install -g tslint` | |
(require 'company) | |
(add-hook 'typescript-mode-hook | |
(lambda () | |
(tide-setup) | |
(flycheck-mode t) | |
(setq flycheck-check-syntax-automatically '(save idle-change new-line mode-enabled)) | |
(eldoc-mode t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
value: 1 | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Helper.helper(function equalHelper(params) { | |
return params[0] === params[1]; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.transition( | |
this.use('with-hook', 'fade', { duration: 250 }); | |
); |