File: src/packages/common/components/i18n/services/i18nService.js

Recommend this page to a friend!
  Classes of Alien Fernandez   Seed Sails Angular   src/packages/common/components/i18n/services/i18nService.js   Download  
File: src/packages/common/components/i18n/services/i18nService.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Seed Sails Angular
Full stack framework based on Sails, Node, Angular
Author: By
Last change: Update of src/packages/common/components/i18n/services/i18nService.js
Date: 2 years ago
Size: 862 bytes
 

Contents

Class file image Download
import commonModule from '../../../commonModule'; class i18nLoaderService { /*ngInject*/ constructor($q, $http) { //Promise that runs when you have service response // return loaderFn return (options) => { let module = options.module || "system"; let uri = "app/packages/" + module + "/i18n/locale-"; return new Promise((resolve, reject) => { $http({ method: 'GET', url: uri + options.key + '.json' }).success((data) => { resolve(data); }).error((error) => { reject(error); }); }); }; } } commonModule.factory('i18nLoader', ['$q', '$http', ($q, $http) => new i18nLoaderService($q, $http)]); export default commonModule;