Repository navigation
Expand file tree
/
Copy pathbindings.ts
More file actions
74 lines (65 loc) · 1.74 KB
/
Copy pathbindings.ts
File metadata and controls
74 lines (65 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import {provide, DirectiveResolver} from 'angular2/angular2';
import {BaseRequestOptions, HTTP_PROVIDERS, MockBackend} from 'angular2/http';
import {Router, RouteRegistry, Location} from 'angular2/router';
import {SpyLocation} from 'angular2/src/mock/location_mock';
import {RootRouter} from 'angular2/src/router/router';
import {Http, XHRBackend} from 'app/http';
import {App} from 'app/components';
import {
ErrorHandler,
FeedService,
LoginService,
MicropostService,
RelationshipService,
UserMicropostService,
UserService,
} from 'app/services';
const APP_HTTP_PROVIDERS = [
HTTP_PROVIDERS,
XHRBackend,
BaseRequestOptions,
provide(Http, {
useFactory: (backend, defaultOptions) => new Http(backend, defaultOptions),
deps: [XHRBackend, BaseRequestOptions],
}),
];
const APP_SERVICE_PROVIDERS = [
ErrorHandler,
FeedService,
LoginService,
MicropostService,
RelationshipService,
UserMicropostService,
UserService,
];
export const APP_PROVIDERS = [
APP_HTTP_PROVIDERS,
APP_SERVICE_PROVIDERS,
];
// ---------------
const APP_TEST_HTTP_PROVIDERS = [
HTTP_PROVIDERS,
BaseRequestOptions,
MockBackend,
provide(Http, {
useFactory: (backend, defaultOptions) => new Http(backend, defaultOptions),
deps: [MockBackend, BaseRequestOptions],
}),
];
const APP_TEST_ROUTER_PROVIDERS = [
RouteRegistry,
DirectiveResolver,
provide(Location, {useClass: SpyLocation}),
provide(Router, {
useFactory: (registry, location) => {
return new RootRouter(registry, location, App);
},
deps: [RouteRegistry, Location]
}),
];
const APP_TEST_SERVICE_PROVIDERS = APP_SERVICE_PROVIDERS;
export const APP_TEST_PROVIDERS = [
APP_TEST_SERVICE_PROVIDERS,
APP_TEST_ROUTER_PROVIDERS,
APP_TEST_HTTP_PROVIDERS,
];