Skip to content

Instantly share code, notes, and snippets.

@3gwebtrain
Last active January 9, 2018 07:07
Show Gist options
  • Save 3gwebtrain/b7b835285e07f24d8f2b1ed0d6fdf754 to your computer and use it in GitHub Desktop.
Save 3gwebtrain/b7b835285e07f24d8f2b1ed0d6fdf754 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:DS.attr('string'),
age:DS.attr('number')
});
import Ember from 'ember';
export default Ember.Route.extend({
model(){
return {
"data" : {
"group" : [{"group":"newGroup"}, {"group":"oldGroup"}],
"details" : [{"name":"arif","age":"3"}, {"name":"afi","age":"2"}]
}
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
<ul>
{{#each model.data.details as |data index| }}
<li>
{{get this (concat "model.data.group." index ".group")}}
{{data.name}} -- {{data.age}}
</li>
{{/each}}
</ul>
<br>
<br>
{
"version": "0.13.0",
"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.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment