Ember Data Mockjax
by alexspeller
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-mockjax/1.5.2/jquery.mockjax.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script>
<script src="http://ember.alexspeller.com/ember-latest.js"></script>
<script src="http://ember.alexspeller.com/ember-data-latest.js"></script>
<script src="https://rawgit.com/rmm5t/jquery-timeago/master/jquery.timeago.js"></script>
<script type="text/x-handlebars">
{{#each createdAt}}
{{time-ago date=this}}
{{/each}}
</script>
JavaScript
window.App = Em.Application.create();
App.ApplicationController = Em.Controller.extend({
createdAt: [new Date(), new Date(), new Date()]
});
App.TimeAgoComponent = Ember.Component.extend({
tagName: 'abbr',
classNames: ['timeago'],
attributeBindings: ['title'],
title: function() {
return this.get('date').toString();
}.property('date'),
didInsertElement: function() {
this.$().timeago();
}.observes('title')
});