Skip to content

Instantly share code, notes, and snippets.

@KTKate
KTKate / goal-area.js
Last active August 29, 2015 14:24
How to bubble this action
{{#detail-area as |goalArea|}}
{{#if showForm}}
//form stuff
<button {{action "save" details target=goalArea}}>Submit</button>
{{else}}
//other stuff
{{/if}}
{{/detail-area}}
export default Ember.Component.extend({
click: function() {
this.set('regChildCount', this.get('regChildCount') + 1);
this.attrs.mutChildCount.update(this.attrs.mutChildCount.value + 1);
this.attrs.mutChildCount.update(this.attrs.mutChildCount.value + 1);
this.attrs.mixChildCount.value = this.attrs.mixChildCount.value + 1;
}
export default Ember.TextField.extend({
didInsertElement() {
this.$().focus();
this.$().addClass('focus'); // headless testing is brittle
}
});
export default Ember.Component.extend({
unicorn: "default",
click: function() {
const strngs = ['i', 'want', 'to', 'go', 'home'];
this.attrs.unicorn.update(
strngs[Math.floor(Math.random()*strngs.length)]
);
}
});
@KTKate
KTKate / application.route.js
Last active August 29, 2015 14:25 — forked from lmcardle/application.route.js
Ember.computed.oneWay issue
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return {name: 'sam', age: 2};
}
});
@KTKate
KTKate / smth.js
Created July 24, 2015 14:34
more oneWay twiddling
// sdf
import Ember from 'ember';
export default Ember.Controller.extend({
});
import Ember from 'ember';
const {computed} = Ember;
export default Ember.Component.extend({
tagName: 'a',
didInsertElement() {
this._super(...arguments);
Ember.run.scheduleOnce('afterRender', this, this._setupDropdown);
},
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
width: 5
});
@KTKate
KTKate / cats.template.hbs
Created August 8, 2015 20:56
Routing & Linking Fail
<h1>Meow!</h1>