Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
  <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css">
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  <script src="http://builds.emberjs.com/canary/ember.debug.js"></script>
  <script src="http://builds.emberjs.com/canary/ember-template-compiler.js"></script>
</head>
<body>
  <div id='app'></div>
  <pre id="logs"></pre>
  
  <script type="text/x-handlebars">
    <h2>rwjblue's Ember JSBins</h2>
    
    <p>This input is live-bound to \{{name}}.</p>
    <div>
      {{input value=name}}
    </div>
    <hr />
    
    Current \{{name}} value: {{name}}
    <hr />
    <p>This input will rerender as needed when the upstream value changes, but will send an action when you hit enter. The calling site has created a "auto-mut" action (instead of implementing one in its `actions` hash).  This could easily be refactored from the calling location without affecting the downstream component (since it is "simply" sending an action with the new value).</p>
    
    {{labeled-input label="Name:" value=name update=(action (mut name))}}
  </script>
  
  <script type="text/x-handlebars" id="components/labeled-input">
    <label> {{attrs.label}}
      {{input value=currentValue enter=attrs.update}}
    </label>
  </script>
</body>
</html>
 
/* Put your CSS here */
html, body {
    margin: 20px;
}
 
App = Ember.Application.create({
  rootElement: '#app',
  LOG_RESOLVER: true
});
App.Router.map(function() {
});
App.ApplicationRoute = Ember.Route.extend({
  actions: {
    error: function(error) {
      log(error.message);
    }
  }  
});
App.LabeledInputComponent = Ember.Component.extend({
  didReceiveAttrs : function() {
    this.set('currentValue', this.attrs.value);
  }
})
Ember.onerror = function(error) {
  log(error.stack);
};
function log() {
  var msg = [].slice.call(arguments).join(' ');
  logs.insertBefore(document.createTextNode("\n" + msg), logs.firstChild);
}
Output 300px

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

Dismiss x
public
Bin info
rwjbluepro
0viewers