EdenMobile Services
Table of Contents
Services in EdenMobile are singleton objects providing access to global data and functionality.
Services Overview
Name | Functionality |
---|---|
emDB | Low-level Database Access (tables) |
emDialogs | Generic Popup/Popover User Dialogs |
emConfig | Global Configuration Settings |
emFiles | Uploaded Files |
emForms | Introspective Form Building |
emResources | High-level Database Access (resources) |
emS3JSON | S3JSON codec |
emServer | Sahana Server Access |
emSQL | SQL Construction (SQLite) |
emSync | Synchronization with Sahana Server |
emUtils | Utility Functions |
emReset | Database Reset |
Accessing Services
To access a service in a controller/service/directive/filter, it must be injected.
To do this, the service can be added to the dependency list in the declaration:
EdenMobile.controller('EMSomeController', [ '$scope', '$state', '$stateParams', 'emDialogs', // <== depenency list function($scope, $state, $stateParams, emDialogs) { // <== injected dependencies become parameters // Accessing the service: emDialogs.confirmation(...); });
...or it can be dynamically injected (e.g. to avoid circular dependencies), using the $injector
service:
EdenMobile.factory('emSomeService', [ '$injector', // <== $injector in dependency list function ($injector) { // <== $injector as parameter // Dynamically inject, then access the service var emDialogs = $injector.get('emDialogs'); emDialogs.confirmation(...); });
Last modified
5 years ago
Last modified on 07/05/19 08:02:46
Note:
See TracWiki
for help on using the wiki.