[SDC-29] rebase continue work to align source
[sdc.git] / catalog-ui / src / app / ng2 / utils / ng1-upgraded-provider.ts
1 /**
2  * Created by rc2122 on 4/6/2017.
3  */
4 import {DataTypesService} from "../../services/data-types-service";
5 import ICacheObject = angular.ICacheObject;
6 import {SharingService} from "../../services/sharing-service";
7 import {CookieService} from "../../services/cookie-service";
8 import {CacheService} from "../../services/cache-service";
9 import {EventListenerService} from "app/services/event-listener-service";
10
11 /** Services we need to upgrade from angular1 to angular2 - in the future we need to rewrite them all to angular2 **/
12
13 export function dataTypesServiceFactory(cacheObj: ICacheObject) {
14     return cacheObj.get('Sdc.Services.DataTypesService');
15 }
16
17 export function sharingServiceFactory(cacheObj: ICacheObject) {
18     return cacheObj.get('Sdc.Services.SharingService');
19 }
20
21 export function cookieServiceFactory(cacheObj: ICacheObject) {
22     return cacheObj.get('Sdc.Services.CookieService');
23 }
24
25 export function stateParamsServiceFactory(cacheObj: ICacheObject) {
26     return cacheObj.get('$stateParams');
27 }
28
29 export function cacheServiceFactory(cacheObj: ICacheObject) {
30     return cacheObj.get('Sdc.Services.CacheService');
31 }
32
33 export function eventListenerServiceServiceFactory(cacheObj: ICacheObject) {
34     return cacheObj.get('EventListenerService');
35 }
36
37 export const DataTypesServiceProvider = {
38     provide: DataTypesService,
39     useFactory: dataTypesServiceFactory,
40     deps: ['$injector']
41 };
42
43
44 export const SharingServiceProvider = {
45     provide: SharingService,
46     useFactory: sharingServiceFactory,
47     deps: ['$injector']
48 };
49
50
51 export const CookieServiceProvider = {
52     provide: CookieService,
53     useFactory: cookieServiceFactory,
54     deps: ['$injector']
55 };
56
57 export const StateParamsServiceFactory = {
58     provide: '$stateParams',
59     useFactory: stateParamsServiceFactory,
60     deps: ['$injector']
61 };
62
63 export const CacheServiceProvider = {
64     provide: CacheService,
65     useFactory: cacheServiceFactory,
66     deps: ['$injector']
67 };
68
69 export const EventListenerServiceProvider = {
70     provide: EventListenerService,
71     useFactory: eventListenerServiceServiceFactory,
72     deps: ['$injector']
73 };