AppStateService Class
Service for managing the state of the application. By default, to display application states, the states in Form Semantic UI are used.
Usage example
- Add a service to the application controller.
// app/controllers/application.js
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default Controller.extend({
appState: service(),
});
- Use the application state in the template.
<div class="ui form">
</div>
- Use the service in another controller (or component).
// app/controllers/my-controller.js
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default Controller.extend({
appState: service(),
actions: {
load() {
this.get('appState').loading();
this.load().finally(() => {
this.get('appState').reset();
});
},
},
});
Item Index
Properties
Methods
error
()
Sets the application state as error
.
loading
()
Sets the application state as loading
.
reset
()
Sets the application state to the default value.
success
()
Sets the application state as success
.
validationHide
()
Sets the application validation as validation-hide
.
validationShow
()
Sets the application validation to the default value.
warning
()
Sets the application state as warning
.