Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
store: Ember.inject.service(),
actions: {
createClosing() {
const closing = this.get('store').createRecord('closing');
this.set('closing', closing);
},
save() {
this.get('closing').save();
},
},
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
value: attr('number'),
});
<h1>Welcome to {{appName}}</h1>
<h2>Valor: {{closing.value}}</h2>
<br>
<br>
<button onclick={{action "createClosing"}}>Criar</button>
{{#if closing}}
<form onsubmit={{action "save"}}>
<label>Value {{input value=closing.value}}</label>
<button type="submit">Salvar</button>
</form>
{{/if}}
<br>
<br>
{
"version": "0.10.7",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.10.0",
"ember-data": "2.10.0",
"ember-template-compiler": "2.10.0",
"ember-testing": "2.10.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment