A simple loading indicator, while your static assets download, and your Ember.js app starts up.
ember install ember-load
You can customize this addon in your environment/config.js
module.exports = function(environment) {
var ENV = {
// optional
'ember-load': {
// This is the default value, if you don't set this option
loadingIndicatorClass: 'ember-load-indicator'
}
...
}
...
}
And then place some HTML in your app/index.html
<div class="ember-load-indicator">
CAN I HAS APP NOW?
</div>
Finally, place the following in your app/templates/application.hbs
The loading indicator will be removed when your application view is inserted into the DOM
Anything that's purely CSS or plain JavaScript should work beautifully. You'll have the best luck with things that require no scripts or assets (i.e., images) to run in the browser.
- Spinkit
- Single Element CSS Loaders
- css-spinners.com
- CSS-only loaders
- Tim Holman's Loaders and Spinners Collection
- cssload.net
You may also override or extend the default "load indicator removal" hook, by creating a component in your app called ember-load-remover
import EmberLoadRemover from 'ember-load/components/ember-load-remover';
export default EmberLoadRemover.extend({
removeLoadingIndicator() {
// Perform default behavior
this._super(...arguments);
// Do something custom in addition to it
console.log('Just so you know, your app has loaded. 🚀');
}
});
This add-on can be used with or without Ember.View
s
Ember Version Range | Notes |
---|---|
>= 1.11 | Can be used with Ember.View, or using the component ({{ember-load-remover}} ) |
2.0 - 2.4 | Can be used with Ember.View (via ember-legacy-views), or using the component ({{ember-load-remover}} ) |
>= 2.5 | Must be used via component ({{ember-load-remover}} ), as ember-legacy-views is not compatible with Ember 2.5 |
git clone
this repositorynpm install
bower install
ember server
- Visit your app at http://localhost:4200.
ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.