Skip to content

Instantly share code, notes, and snippets.

View helpers.guid-for\.js
import { helper } from '@ember/component/helper';
export default helper(function guidFor(params/*, hash*/) {
return Ember.guidFor(params[0]);
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Controller from '@ember/controller';
import { computed } from '@ember/object';
const values = [
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
];
export default Controller.extend({
sliderIndex: 1,
View components.my-component\.js
import Component from '@glimmer/component';
export default class extends Component {
constructor() {
super();
this.classNames = [];
}
}
View components.checkbox-component.js
import Ember from 'ember';
export default Ember.Component.extend({});
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super();
this.set('bar', { foo: 'stuff' });
this.set('keys', Object.keys(Ember.get(this, 'bar')));
},
actions: {
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super();
this.set('bar', { foo: 'stuff' });
},
actions: {
foo() {
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
save: function() {
alert('saving ' + this.get('foo'));
}
}
});
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
updateCount: 0,
didUpdateAttrs() {
this._super(...arguments)
console.log("didUpdateAttrs", this.updateCount)
debugger
this.updateCount++;
}
View components.x-inner.js
import Ember from 'ember';
let uuid = 0;
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.count = 0;
},
You can’t perform that action at this time.