Created
April 30, 2017 18:50
-
-
Save farisj/12ca19ecb67bcc6b83ebd8d1368cb66a to your computer and use it in GitHub Desktop.
Dangerous oneWays
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 { computed, set } = Ember; | |
export default Ember.Component.extend({ | |
todo: null, | |
title: computed.oneWay('todo.title'), | |
body: computed.oneWay('todo.body'), | |
actions: { | |
updateBody(){ | |
set(this, 'body', 'jk, do this thing. haha! youre stuck doing this thing instead'); | |
} | |
} | |
}); |
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 { set } = Ember; | |
export default Ember.Controller.extend({ | |
todos: null, | |
selectedTodo: null, | |
actions: { | |
pageTodo(todo) { | |
set(this, 'selectedTodo', todo); | |
} | |
} | |
}); |
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'; | |
export default Ember.Route.extend({ | |
model() { | |
return [ | |
{ title: 'Todo A', body: 'Do Thing A'}, | |
{ title: 'Todo B', body: 'Do Thing B'}, | |
{ title: 'Todo C', body: 'Do Thing C'}, | |
] | |
}, | |
setupController(controller, model) { | |
controller.setProperties({ | |
todos: model | |
}) | |
} | |
}); |
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
.todos { | |
margin: 75px; | |
text-align: center; | |
} | |
.selected-todo { | |
border: 1px solid black; | |
padding: 25px; | |
height: 150px; | |
} | |
.todo__content { | |
padding-bottom: 25px; | |
} |
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.12.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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment