Skip to content

Instantly share code, notes, and snippets.

@rwjblue
rwjblue / controllers.application\.js
Last active December 23, 2020 15:42
Reproduction autoplay/muted video
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
queryParams: ['categories', 'serachQuery'],
categories: [],
serachQuery: '',
import { helper } from '@ember/component/helper';
export default helper(function guidFor(params/*, hash*/) {
return Ember.guidFor(params[0]);
});
@rwjblue
rwjblue / controllers.application.js
Created May 8, 2020 14:50 — forked from asakusuma/controllers.application.js
each-in dot notation and getter
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
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,
import Ember from 'ember';
export default Ember.Component.extend({});
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: {
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super();
this.set('bar', { foo: 'stuff' });
},
actions: {
foo() {
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
save: function() {
alert('saving ' + this.get('foo'));
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
updateCount: 0,
didUpdateAttrs() {
this._super(...arguments)
console.log("didUpdateAttrs", this.updateCount)
debugger
this.updateCount++;
}