Contact list
{
"version": "0.10.4",
"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.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
<h1>Welcome to {{appName}}</h1>
<br>
Add contact:
{{input value=name}}
<button {{action 'addContact'}}>Add</button>
<hr>
CONTACTS:
<ul>
{{#each contactList as |name|}}
<li>{{name}}</li>
{{/each}}
</ul>
<br>
{{outlet}}
<br>
<br>
import Ember from 'ember';
export default Ember.Controller.extend({
name: null,
contactList: [],
appName: 'Ember Twiddle',
actions: {
addContact() {
var name = this.get('name');
var cList = this.get('contactList');
cList.pushObject(name);
console.log(cList);
}
}
});