Created
September 14, 2018 23:37
-
-
Save HeroicEric/2a850152b8e441309d8969f07189a9c3 to your computer and use it in GitHub Desktop.
envoy-thing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { get } = Ember; | |
export default Ember.Component.extend({ | |
tagName: 'form', | |
name: '', | |
submit(ev) { | |
ev.preventDefault(); | |
let signIn = get(this, 'signIn'); | |
let name = get(this, 'name'); | |
signIn(name); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { get, set } = Ember; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
lastId: 1, | |
people: [{ | |
id: 0, | |
name: 'eric' | |
}, { | |
id: 1, | |
name: 'robbie' | |
}], | |
actions: { | |
signOut(personId) { | |
let people = get(this, 'people'); | |
let newPeople = people.filter(person => { | |
return person.id !== personId; | |
}); | |
set(this, 'people', newPeople); | |
}, | |
signIn(name) { | |
let people = get(this, 'people'); | |
let id = get(this, 'lastId') + 1; | |
let newPerson = { | |
id, | |
name | |
}; | |
set(this, 'people', people.concat(newPerson)); | |
set(this, 'lastId', id); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment