Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <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="//builds.emberjs.com/tags/v1.13.7/ember-template-compiler.js"></script>
    <script src="//builds.emberjs.com/tags/v1.13.7/ember.debug.js"></script>
  </head>
<body>
  <script type="text/x-handlebars" data-template-name="application">
  <h1>Ember Base</h1>
  {{outlet}}
  </script>
  <script type="text/x-handlebars" data-template-name="index">
    <h2>Index</h2>
    {{#each model as |item|}}
       {{x-component item=item}}
    {{/each}}
    <button {{action 'remove-top'}}>Remove Top</button>
  </script>
  <script type="text/x-handlebars" data-template-name="components/x-component">
    {{computedProp}}
  </script>
</body>
</html>
 
/* Put your CSS here */
    body {
      font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
      margin: 20px;
    }
.bar {
  color: blue;
}
 
App = Ember.Application.create();
App.IndexRoute = Ember.Route.extend({
  model: function() {
    return [
      {name: 'Jason'},
      {name: 'Tom'},
      {name: 'Stef'},
      {name: 'Brian'},
    ]
  }
});
App.IndexController = Ember.Controller.extend({
  actions: {
    'remove-top': function() {
      this.get('model').removeAt(0);
    }
  }
});
App.XComponentComponent = Ember.Component.extend({
  computedProp: Ember.computed('item.name', function() {
    console.log('ping');
    return this.get('item.name');
  })
});
Output

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

Dismiss x
public
Bin info
jasonmitpro
0viewers