Skip to content

Instantly share code, notes, and snippets.

View chriskrycho's full-sized avatar
🚀
Hire me! https://v5.chriskrycho.com/journal/next/role/

Chris Krycho chriskrycho

🚀
Hire me! https://v5.chriskrycho.com/journal/next/role/
View GitHub Profile
import Controller from '@ember/controller';
import { computed } from '@ember/object';
export default class ApplicationController extends Controller {
series;
@computed('series.length')
get seriesLength() {
return this.get('series.length');
}
@chriskrycho
chriskrycho / controllers.application\.js
Last active October 26, 2020 20:49
basically you're just hosed
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
@tracked somePojo;
@tracked timeLeft;
timeout;
interval;
@chriskrycho
chriskrycho / components.no-updates\.hbs
Last active September 16, 2020 18:58
tracked is necessary
<p>
the value is: {{@value}}
</p>
<button {{on "click" @click}}>
CLICK
</button>
<button {{on "click" @click}}>
CLICK
</button>
{{yield (hash block='data' data='yields are cool')}}
<div>
{{yield 'and you can do neat tricks with them'}}
</div>
@chriskrycho
chriskrycho / components.child\.hbs
Created August 27, 2020 18:48
local and global state
<div>
{{@name}} is open: {{if this.isOpen 'true' 'false'}}
<button {{on "click" this.open}}>open</button>
<button {{on "click" this.close}}>close</button>
</div>
import Controller from '@ember/controller';
import { getOwner } from '@ember/application';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
usingFactoryFor;
constructor() {
super(...arguments);
this.usingFactoryFor = getOwner(this).factoryFor('service:my-service').create().neato;
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}