I’m trying to build my first component and having a little problem. I’m using the codemirror.js library to incorporate a code editor into my site and I have the code editor displaying on the screen, but I can’t figure out how to get my data to show up in the control.
I want the data from content to display in the editor when it first loads and I’d like to have the data bind to that property.
this tells the component to render as a textarea so you don’t need the template.
self.$().get(0)
this is how you get a reference to the component’s element (instead of document.findByElementId).
Ember.run(function(){
this is necessary because the codemirror component doesn’t know anything about ember’s run loop. This will make sure that the change is integrated into ember’s lifecycle.
updateValue
this watches for changes to the component’s ‘value’ and updates the codemirror component.
Thanks for the description of the changes. That does help but it still doesn’t seem to populate the codemirror component with the data when the page jsfiddle loads. Anything else that I could be missing?