123456789101112131415161718192021222324252627282930313233343536373839 |
- /**
- * Created by robin on 11/21/15.
- */
-
- (function () {
- 'use strict';
-
- angular.module('camotionAdmin')
- .factory('HelperService', ['HostsService', 'CamerasService', '$q', function (HostsService, CamerasService, $q) {
-
- var HelperService = {};
-
- HelperService.getForeignEntities = function (promise) {
- var defer = $q.defer();
- HostsService.getAll({}, promise).then(function (hosts) {
- var hostsArray = {};
- for (var i = 0; i < hosts.Data.length; ++i) {
- var host = hosts.Data[i];
- hostsArray[host.Id] = host;
- }
- CamerasService.getAllTypes(promise).then(function(types)
- {
- var typesArray = {};
- for (var i = 0; i < types.Data.length; ++i) {
- var type = types.Data[i];
- typesArray[type.Id] = type;
- }
- defer.resolve({
- hosts: hostsArray,
- entityTypes: typesArray
- });
- }, defer.reject);
- }, defer.reject);
- return defer.promise;
- };
-
- return HelperService;
- }]);
- })();
|