Skip to content

Instantly share code, notes, and snippets.

@wonderful123
Forked from ef4/application.controller.js
Last active May 25, 2018 14:03
Show Gist options
  • Save wonderful123/cd981254bc0262f00c13ae6aabdb0261 to your computer and use it in GitHub Desktop.
Save wonderful123/cd981254bc0262f00c13ae6aabdb0261 to your computer and use it in GitHub Desktop.
Component Subexpressions one-way by default?
import Ember from 'ember';
export default Ember.Controller.extend({
optionList: {
changePercentage: {
type: 'input',
value: 10
},
duration: {
type: 'input',
value: '60s'
}
}
});
{{#each-in optionList as |id obj|}}
{{component 'x-thing' id=id obj=obj}}
Value outside: {{obj.value}}
<br>
<br>
{{/each-in}}
import Ember from 'ember';
export default function destroyApp(application) {
Ember.run(application, 'destroy');
}
import Resolver from '../../resolver';
import config from '../../config/environment';
const resolver = Resolver.create();
resolver.namespace = {
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix
};
export default resolver;
import Ember from 'ember';
import Application from '../../app';
import config from '../../config/environment';
const { run } = Ember;
const assign = Ember.assign || Ember.merge;
export default function startApp(attrs) {
let application;
let attributes = assign({rootElement: "#test-root"}, config.APP);
attributes = assign(attributes, attrs); // use defaults, but you can override;
run(() => {
application = Application.create(attributes);
application.setupForTesting();
application.injectTestHelpers();
});
return application;
}
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
setResolver(resolver);
{
"version": "0.6.5",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.9.1",
"ember-data": "release",
"ember-template-compiler": "2.9.1"
}
}
import Ember from 'ember';
export default Ember.Component.extend({
label: Ember.computed('id', function() {
var text = this.get('id');
var result = text.replace( /([A-Z])/g, " $1" );
return result.charAt(0).toUpperCase() + result.slice(1);
})
});
<label>
<strong>{{label}}</strong>
{{input value=obj.value}}</label>
<br>Val in component: {{obj.value}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment