Skip to content

Instantly share code, notes, and snippets.

@matt-morris
Created February 22, 2019 19:03
Show Gist options
  • Save matt-morris/2471b8567a56f8ad431663a4002f55d2 to your computer and use it in GitHub Desktop.
Save matt-morris/2471b8567a56f8ad431663a4002f55d2 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return {
"variables": {
"foo": "bar"
},
"pages": [
{
"route": "/",
"body": [
{
"type": "partial",
"name": "header"
},
{
"type": "tag",
"name": "main",
"children": [
{
"type": "tag",
"name": "p",
"attributes": {
"class": "py-4"
},
"children": [
{
"type": "text",
"value": "lorem ipsum blah blah blah"
}
]
}
]
}
]
}
]
}
}
});
<ul>
{{#each-in model.variables as |key value|}}
<label>{{key}}</label>
{{input value=value}}
{{/each-in}}
</ul>
<div>
<label>current state</label>
{{#each-in model.variables as |k v|}}
[ {{k}} - {{v}} ]
{{/each-in}}
</div>
{{outlet}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment