Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
  <link href="//cdn.jsdelivr.net/codemirror/3.14.0/codemirror.css" rel="stylesheet">
  <script src="http://code.jquery.com/jquery-2.0.2.js"></script>
  <script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
  <script src="http://builds.emberjs.com/ember-latest.js"></script>
  <script src="//cdn.jsdelivr.net/codemirror/3.14.0/codemirror.js"></script>
  
</head>
<body>
  <script type="text/x-handlebars" data-template-name="application">    
    {{view App.MyEditorView}}
  </script>
  
  <script type="text/x-handlebars" data-template-name="editor-view">
    {{view view.topView viewName="topViewInstance"}}
    {{view view.CodeMirrorView}}
    {{view view.bottomView viewName="bottomViewInstance"}}
  </script>
  
  <script type="text/x-handlebars" data-template-name="click-here">
    Click me
  </script>
  
</body>
</html>
  
 
App = Ember.Application.create({});
App.IndexRoute = Ember.Route.extend({
  model: function(){
      return [
          {firstName: 'Kris', lastName: 'Selden'},
          {firstName: 'Luke', lastName: 'Melia'},
          {firstName: 'Formerly Alex', lastName: 'Matchneer'}
      ];
  }
});
App.EditorView = Ember.View.extend({
  templateName: 'editor-view',
  topView: Ember.ContainerView.extend(),
  bottomView: Ember.ContainerView.extend(),
  CodeMirrorView: Ember.TextArea.extend({  
    didInsertElement: function() {      
      this.codeMirror = CodeMirror.fromTextArea(this.get('element'));                  
    }
  })
});
App.MyComponent = Ember.View.extend({
  templateName: 'click-here',
  message: null,
  click: function() {
    alert(this.get('message'));
  }
});
App.MyEditorView = App.EditorView.extend({  
  didInsertElement: function() {
    this._super();
    this.get('topViewInstance').pushObject(App.MyComponent.create({ message: "Hello" }));
    
    this.get('bottomViewInstance').pushObject(App.MyComponent.create({ message: "World" }));
  }
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
marciojpro
0viewers