Created
August 11, 2013 22:04
-
-
Save marcioj/6207084 to your computer and use it in GitHub Desktop.
Displays a video with data binding using ember.js http://jsfiddle.net/marciojunior/KZxgp/.
This file contains 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
<script type="text/x-handlebars" data-template-name="video"> | |
{{view view.embedView}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="embed"> | |
<object width="640" height="390"> | |
<param name="movie" {{bindAttr src="view.src"}} ></param> | |
<param name="allowScriptAccess" value="always"></param> | |
<param name="playerapiid" value="main"></param> | |
<embed {{bindAttr src="view.src"}} type="application/x-shockwave-flash" allowscriptaccess="always" width="640" height="390"></embed> | |
</object> | |
</script> |
This file contains 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
App.VideoView = Ember.View.extend({ | |
templateName: 'video', | |
embedView: Ember.View.extend({ | |
src: null, | |
templateName: 'embed', | |
srcBinding: 'parentView.src', | |
viewName: 'embed' | |
}), | |
src: null, | |
srcChanged: function() { | |
this.get('embed').rerender(); | |
}.observes('src') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment