Skip to content

Instantly share code, notes, and snippets.

@nickschot
Last active September 6, 2018 08:38
Show Gist options
  • Save nickschot/c5e6cf5dddda396fb54e649ae387b808 to your computer and use it in GitHub Desktop.
Save nickschot/c5e6cf5dddda396fb54e649ae387b808 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';
export default Model.extend({
name: attr('string'),
user: belongsTo()
});
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';
export default Model.extend({
post: hasMany()
});
import Ember from 'ember';
export default Ember.Route.extend({
model(){
return this.store.createRecord('post');
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<h1>Edit Post</h1>
{{#bs-form model=(changeset model) as |form|}}
{{form.element controlType="text" label="Name"}}
{{#form.element controlType="model-select" propertyName="user" label="User" as |el|}}
{{el.control}}
{{/form.element}}
{{/bs-form}}
<br>
<br>
{
"version": "0.15.0",
"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.2.2",
"ember-template-compiler": "3.2.2",
"ember-testing": "3.2.2"
},
"addons": {
"ember-data": "3.2.0",
"ember-changeset": "1.5.0",
"ember-bootstrap": "2.0.0",
"bootstrap": "4.1.0",
"ember-model-select": "0.1.0-alpha.4",
"ember-bootstrap-model-select": "0.1.0-alpha.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment