Skip to content

Instantly share code, notes, and snippets.

@jgwhite
Created February 6, 2014 17:06
Show Gist options
  • Save jgwhite/8848382 to your computer and use it in GitHub Desktop.
Save jgwhite/8848382 to your computer and use it in GitHub Desktop.
App = Ember.Application.create();
App.Router.map(function () {
this.resource('slow', function () {
this.resource('really-slow');
});
});
App.SlowRoute = Ember.Route.extend({
model: function () {
return new Ember.RSVP.Promise(function (resolve, reject) {
setTimeout(function () {
resolve({});
}, 500);
});
}
});
App.ReallySlowRoute = Ember.Route.extend({
model: function () {
return new Ember.RSVP.Promise(function (resolve, reject) {
setTimeout(function () {
resolve({});
}, 1000);
});
}
});
body {
padding: 1em;
}
<script type="text/x-handlebars">
<ul>
<li>{{#link-to "index"}}Home{{/link-to}}</li>
<li>{{#link-to "slow"}}Slow{{/link-to}}</li>
<li>{{#link-to "really-slow"}}Really slow{{/link-to}}</li>
</ul>
{{outlet}}
</script>
<script type="text/x-handlebars" id="index">
<p>Home</p>
</script>
<script type="text/x-handlebars" id="loading">
<p>Loading…</p>
</script>
<script type="text/x-handlebars" id="slow">
<p>Slow</p>
{{outlet}}
</script>
<script type="text/x-handlebars" id="slow/loading">
<p>Slow loading…</p>
</script>
<script type="text/x-handlebars" id="really-slow">
<p>Really slow</p>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment