Ember.js states
by rsaccon
HTML
<script src="https://github.com/downloads/emberjs/ember.js/ember-0.9.3.js"></script>
<script type="text/x-handlebars">
{{#each App.controller}}
{{#view App.View contentBinding="this"}}
{{#with content}}
{{#if isLoaded}}
{{title}}
{{else}}
loading...
{{/if}}
{{/with}}
{{/view}}
{{else}}
<div class="empty">
empty ...
</div>
{{/each}}
</script>
JavaScript
App = Ember.Application.create({});
App.controller = Em.ArrayController.create({
content: [],
});
App.View = Em.View.extend({
});
setTimeout(function(){
App.controller.set('content', [{title:"foo"}, {title:"bar"}])
}, 2000);