Last active
August 1, 2016 19:27
-
-
Save astronomersiva/c03e039a80cae64d7d779ff3cdecac76 to your computer and use it in GitHub Desktop.
glimmer
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.Controller.extend({ | |
fields: Ember.A(), | |
actions: { | |
// doesn't work | |
addField( ) { | |
let fields = this.get('fields'); | |
fields.insertAt(0, { | |
label: '1' | |
}); | |
this.set('fields', fields); | |
}, | |
// doesn't work when the line 42 is updated to | |
// fields.objectAt(1) or fields.objectAt(2) | |
// addField( ) { | |
// let fields = this.get('fields'); | |
// fields.pushObject({ | |
// label: '1' | |
// }); | |
// this.set('fields', fields); | |
// }, | |
// works when the line 42 is updated to | |
// fields.objectAt(1) or fields.objectAt(2) | |
// addField( ) { | |
// let fields = this.get('fields'); | |
// fields.pushObjects([{ | |
// label: '1' | |
// }, { | |
// label: '2' | |
// }]); | |
// this.set('fields', fields); | |
// }, | |
addToField( ) { | |
let fields = this.get('fields'); | |
let currentField = fields.objectAt(0); | |
let label = currentField.label + '1'; | |
Ember.set(currentField, 'label', label); | |
console.log(fields, currentField); | |
} | |
} | |
}); |
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.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": "alpha", | |
"ember-data": "2.7.0", | |
"ember-template-compiler": "alpha" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment