Ember Latest

The latest build of Ember.

by Kerrick

HTML

<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<script type="text/x-handlebars" data-template-name="application">
    <h1>ember-latest jsfiddle</h1>
    {{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
  <h2>Index Content:</h2>
  <code>Ember.String.fmt</code> with params: <code>{{stringFmt}}</code>
  <br />
  <code>String.prototype.fmt</code> with params: <code>{{fmt}}</code>
  <br />
  <code>Ember.String.fmt</code> with array: <code>{{stringFmtArray}}</code>
  <br />
  <code>String.prototype.fmt</code> with array: <code>{{fmtArray}}</code>
</script>

CSS

h1 { font-size: 1.6em; padding-bottom: 10px; }
h2 { font-size: 1.4em; }
ul { padding: 15px; font-size: 1.4em; color: green; }

JavaScript

App = Ember.Application.create({});

App.IndexRoute = Ember.Route.extend({
  model: function(){
      return { host: 'http://example.com', ns: 'api/v1', resource: 'people' };
  }
});

App.IndexController = Ember.ObjectController.extend({
    stringFmt: Ember.computed('host', 'ns', 'resource', function() {
        return Ember.String.fmt('%@1/%@2/%@3', this.get('host'), this.get('ns'), this.get('resource'));
    }),
    fmt: Ember.computed('host', 'ns', 'resource', function() {
        return '%@1/%@2/%@3'.fmt(this.get('host'), this.get('ns'), this.get('resource'));
    }),
    stringFmtArray: Ember.computed('host', 'ns', 'resource', function() {
        return Ember.String.fmt('%@1/%@2/%@3', [this.get('host'), this.get('ns'), this.get('resource')]);
    }),
    fmtArray: Ember.computed('host', 'ns', 'resource', function() {
        return '%@1/%@2/%@3'.fmt([this.get('host'), this.get('ns'), this.get('resource')]);
    })
});