Skip to content

Instantly share code, notes, and snippets.

@Sinled
Created August 2, 2015 14:36
Show Gist options
  • Save Sinled/5bc3335491654b000413 to your computer and use it in GitHub Desktop.
Save Sinled/5bc3335491654b000413 to your computer and use it in GitHub Desktop.
loading resolver
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
loading() {
console.log('loading');
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
<h2>Application Index page</h2>
{{#link-to "posts.index"}}posts{{/link-to}}
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return new Ember.RSVP.Promise(function (resolve, reject) {
Ember.run.later(function () {
resolve();
}, 1000);
});
}
});
{{link-to 'index' 'index'}}
<h1>posts index</h1>
{{outlet}}
<h1>posts</h1>
{{outlet}}
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('posts', function() {});
});
export default Router;
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{
"version": "0.4.6",
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.5/ember.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.5/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.5/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment