Last active
September 21, 2017 02:31
-
-
Save allthesignals/2c57bf2e4fc9f6341862aad3ca0ae325 to your computer and use it in GitHub Desktop.
Weird Attr Binding Issue
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.Component.extend({ | |
| didUpdateAttrs() { | |
| alert('did receive attributes on child component') | |
| }, | |
| }); |
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.Component.extend({ | |
| config: {}, | |
| arbitraryString: 'peanut butter', | |
| anotherProperty: true, | |
| isReady: Ember.computed('config', 'anotherProperty', 'arbitraryString', function() { | |
| return !!(this.get('anotherProperty') && this.get('arbitraryString')) | |
| }), | |
| actions: { | |
| toggleDependentKey() { | |
| const config = this.get('config'); | |
| const layers = Ember.get(config, 'layers'); | |
| const targetLayerIndex = 0; | |
| const targetLayer = layers.objectAt(targetLayerIndex); | |
| Ember.set(targetLayer, 'layer',{ config: { color: 'purple' } }); | |
| }, | |
| }, | |
| }); |
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({ | |
| appName: 'Ember Twiddle', | |
| weirdObject: { | |
| layers: [ | |
| { | |
| layer: { | |
| id: 'test', | |
| config: { | |
| color: 'blue' | |
| }, | |
| } | |
| }, | |
| { | |
| layer: { | |
| id: 'test2', | |
| config: { | |
| color: 'green' | |
| }, | |
| } | |
| } | |
| ] | |
| } | |
| }); |
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