Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Ember from 'ember';
- export default Ember.Controller.extend({
- appName: 'Ember Twiddle',
- init() {
- this.set('parent', this.store.createRecord('parent', {name:'foo'}))
- },
- actions: {
- addNewChild() {
- console.log(`@ foo`)
- const child = this.store.createRecord('child', {parent: this.parent})
- this.set('child', child)
- },
- unloadLastChild() {
- if (this.child) {
- this.child.set('parent', null)
- this.child.unloadRecord()
- this.set('child', null)
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement