Skip to content

Commit f64eeb6

Browse files
4. Wiring DebugAppConfigService
1 parent fa3535b commit f64eeb6

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

ADF_1.7.0/upgrade-from-1-6/app/app.module.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { NgModule } from '@angular/core';
2020
import { BrowserModule } from '@angular/platform-browser';
2121
import { Editor3DModule } from 'ng2-3d-editor';
2222

23-
import { CoreModule } from 'ng2-alfresco-core';
23+
import { AppConfigService, CoreModule } from 'ng2-alfresco-core';
2424
import { DataTableModule } from 'ng2-alfresco-datatable';
2525

2626
import { SearchModule } from 'ng2-alfresco-search';
@@ -41,6 +41,7 @@ import { UserInfoComponentModule } from 'ng2-alfresco-userinfo';
4141
import { ViewerModule } from 'ng2-alfresco-viewer';
4242
import { AppComponent } from './app.component';
4343
import { routing } from './app.routes';
44+
import { DebugAppConfigService } from './services/debug-app-config.service';
4445

4546
import {
4647
HomeComponent,
@@ -105,7 +106,9 @@ if (process.env.ENV === 'production') {
105106
SettingComponent,
106107
FormDemoComponent
107108
],
108-
providers: [],
109+
providers: [
110+
{ provide: AppConfigService, useClass: DebugAppConfigService }
111+
],
109112
bootstrap: [ AppComponent ]
110113

111114
, entryComponents: [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*!
2+
* @license
3+
* Copyright 2016 Alfresco Software, Ltd.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { Injectable } from '@angular/core';
19+
import { Http } from '@angular/http';
20+
import { AppConfigService, StorageService } from 'ng2-alfresco-core';
21+
22+
@Injectable()
23+
export class DebugAppConfigService extends AppConfigService {
24+
25+
constructor(private storage: StorageService, http: Http) {
26+
super(http);
27+
}
28+
29+
/** @override */
30+
get<T>(key: string): T {
31+
if (key === 'ecmHost' || key === 'bpmHost') {
32+
return <T>(<any>this.storage.getItem(key) || super.get<T>(key));
33+
}
34+
return super.get<T>(key);
35+
}
36+
37+
}

0 commit comments

Comments
 (0)