Closed etabard closed 12 years ago
I tried to display an array of pictures with each. The src binding fails and the this.get('src') returns a "String object".
Here is my code :
App = Ember.Application.create(); Em.Image = SC.View.extend({ tagName: 'img', attributeBindings: ['src', 'alt'], didChangeSrc: function() { console.log(this.get('src')); }.observes('src') }) App.test = ['http://laughingsquid.com/wp-content/uploads/fsm-google-doodle.png', 'http://www.google.com/intl/en_ALL/images/logos/images_logo_lg.gif'];
<script type="text/x-handlebars"> {{#each App.pictures}} {{view Em.Image srcBinding="this" alt="no image"}} {{/each}} </script>
Exemple here : http://jsfiddle.net/Raildecom/8Rs5c/
Works outside of each : http://jsfiddle.net/justinbrown/8Rs5c/2/
You can use this as a workaround for now
didChangeSrc: function() { this.set('src', String(this.get('src'))); }.observes('src')
Thanks for the quick workaround ;-) It seems odd though !
I tried to display an array of pictures with each. The src binding fails and the this.get('src') returns a "String object".
Here is my code :
Exemple here : http://jsfiddle.net/Raildecom/8Rs5c/
Works outside of each : http://jsfiddle.net/justinbrown/8Rs5c/2/