Skip to content

Instantly share code, notes, and snippets.

@velrest
Last active March 13, 2018 13:57
Show Gist options
  • Save velrest/5cd81d1d8ee203f62ecc021c08a9fa63 to your computer and use it in GitHub Desktop.
Save velrest/5cd81d1d8ee203f62ecc021c08a9fa63 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
this._super(...arguments)
this.set('headers', [{
type: 'test',
title: 'blublibla',
attr: 'name',
filter: this._filter
},
{
type: 'car',
title: 'blublibla',
attr: 'name',
filter: this._filter
}]
)
},
actions: {
a() {
let header = this.get('headers').filterBy('type', 'test')
this.set('model', header.get('filter')(header))
}
},
_filter(header) {
return header.get('title')
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{input key-press=(action send 'a')}}
{{model}}
<br>
<br>
{
"version": "0.13.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "release",
"ember-template-compiler": "release",
"ember-testing": "release"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment