Last active
September 21, 2018 14:10
-
-
Save mjuniper/d944611b6468bb63945e214b029f8980 to your computer and use it in GitHub Desktop.
didUpdateAttrs
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({ | |
init() { | |
this._super(...arguments); | |
this.set('messages', []); | |
}, | |
classNames: ['my-component' ], | |
didReceiveAttrs() { | |
this.get('messages').pushObject('didReceiveAttrs was hit!'); | |
} | |
}); |
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', | |
attr1: 'attr1', | |
attr2: 'attr2', | |
attr3: 'attr3', | |
actions: { | |
updateAttributes (howMany) { | |
if (howMany === 1) { | |
this.set('attr1', Date.now()); | |
} | |
if (howMany === 2) { | |
this.setProperties({ | |
attr1: Date.now(), | |
attr2: Date.now() | |
}); | |
} | |
if (howMany === 3) { | |
this.setProperties({ | |
attr1: Date.now(), | |
attr2: Date.now(), | |
attr3: Date.now() | |
}); | |
} | |
} | |
} | |
}); |
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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.my-component { | |
border: solid 2px gray; | |
} |
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