Skip to content

Instantly share code, notes, and snippets.

@nikz
Created May 19, 2016 16:07
Show Gist options
  • Save nikz/e47a9990dd659b284554acefc040deb8 to your computer and use it in GitHub Desktop.
Save nikz/e47a9990dd659b284554acefc040deb8 to your computer and use it in GitHub Desktop.
Something
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";
const { computed } = Ember;
export default Model.extend({
name: DS.attr("string"),
something: computed("name", function() {
let name = this.get("name");
this.set("displayName", `Captain ${name}`);
}),
greeting: computed("displayName", function() {
let displayName = this.get("displayName");
return `Hello, ${displayName}`;
})
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.createRecord("test-model", { name: "pugwash" });
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{model.name}}
{{model.greeting}}
<br>
<br>
{
"version": "0.8.1",
"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.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment