Tip
All the cool kids are talking about DDAU (data down action up) which is pretty much one-way binding. In other words if you pass abc into a component, the component cannot change the original value – I don’t know why this brings me memories (nightmares) of c++ pointers.
You can now easily do this in ember with ember-one-way-controls
1 |
ember install ember-one-way-controls |
This addon will send an update action with the mutated value, here some example usage:
1 2 3 4 5 |
{{one-way-input value update=(action (mut value))}} {{one-way-textarea value update=(action (mut value))}} {{one-way-checkbox checked update=(action (mut checked))}} {{one-way-radio selected option=option update=(action (mut selected))}} {{one-way-select selected options=options update=(action (mut selected))}} |
Credits & Links
Thank you DockYard for ember-one-way-controls at https://github.com/DockYard/ember-one-way-controls
Free Programming Books and lifetime access to IconApp.io
I am giving away some programming books and lifetime access to iconapp.io library of awesome icons. Check it out at https://gleam.io/XqHjW/rock-and-roll-with-emberjs
Share Your Expertise
Let us know if you have a good ember tip (you will get full credit)
If you are enjoying my daily tips please spread the word with this one-click tweet.
If you do NOT like the tips then please reply to this email and let me know how I can improve them.