diff --git a/demo-shell-ng2/app/app.component.ts b/demo-shell-ng2/app/app.component.ts index d3355849eb..8782e1511d 100644 --- a/demo-shell-ng2/app/app.component.ts +++ b/demo-shell-ng2/app/app.component.ts @@ -6,6 +6,7 @@ import {AuthRouterOutlet} from "./components/AuthRouterOutlet"; import {HomeView} from "./components/home.view"; import {Page1View} from "./components/page1.view"; import {Page2View} from "./components/page2.view"; +import {AlfrescoService} from 'ng2-alfresco/components'; @Component({ selector: 'my-app', @@ -22,8 +23,11 @@ export class AppComponent { constructor( public auth: Authentication, - public router: Router - ){} + public router: Router, + alfrescoService: AlfrescoService + ){ + alfrescoService.host = 'http://192.168.99.100:8080'; + } isActive(instruction: any[]): boolean { return this.router.isRouteActive(this.router.generate(instruction)); diff --git a/demo-shell-ng2/ng2-alfresco/components.d.ts b/demo-shell-ng2/ng2-alfresco/components.d.ts index 9b717241fb..05d6bf9f4b 100644 --- a/demo-shell-ng2/ng2-alfresco/components.d.ts +++ b/demo-shell-ng2/ng2-alfresco/components.d.ts @@ -3,6 +3,7 @@ import { DocumentList } from "./src/document-list.component"; import { AlfrescoService } from "./src/alfresco.service"; export * from './src/HelloWorld'; export * from './src/document-list.component'; +export * from './src/alfresco.service'; declare var _default: { directives: (typeof HelloWorld | typeof DocumentList)[]; providers: typeof AlfrescoService[]; diff --git a/demo-shell-ng2/ng2-alfresco/components.ts b/demo-shell-ng2/ng2-alfresco/components.ts index f1efbff6d4..53bfaac0db 100644 --- a/demo-shell-ng2/ng2-alfresco/components.ts +++ b/demo-shell-ng2/ng2-alfresco/components.ts @@ -4,6 +4,7 @@ import { AlfrescoService } from "./src/alfresco.service"; export * from './src/HelloWorld'; export * from './src/document-list.component'; +export * from './src/alfresco.service'; export default { directives: [HelloWorld, DocumentList], diff --git a/demo-shell-ng2/ng2-alfresco/src/alfresco.service.d.ts b/demo-shell-ng2/ng2-alfresco/src/alfresco.service.d.ts index d44122793b..a8fd80ff63 100644 --- a/demo-shell-ng2/ng2-alfresco/src/alfresco.service.d.ts +++ b/demo-shell-ng2/ng2-alfresco/src/alfresco.service.d.ts @@ -6,7 +6,9 @@ export declare class AlfrescoService { private http; constructor(http: Http); private _host; - private _baseUrl; + private _baseUrlPath; + host: string; + private getBaseUrl(); getFolder(folder: string): Observable; getDocumentThumbnailUrl(document: DocumentEntity): string; getContentUrl(document: DocumentEntity): string; diff --git a/demo-shell-ng2/ng2-alfresco/src/alfresco.service.ts b/demo-shell-ng2/ng2-alfresco/src/alfresco.service.ts index 854ed14a45..67b7c353d7 100644 --- a/demo-shell-ng2/ng2-alfresco/src/alfresco.service.ts +++ b/demo-shell-ng2/ng2-alfresco/src/alfresco.service.ts @@ -8,8 +8,20 @@ import {DocumentEntity} from "./core/entities/document.entity"; export class AlfrescoService { constructor(private http: Http) {} - private _host: string = 'http://192.168.99.100:8080'; - private _baseUrl: string = this._host + '/alfresco/service/slingshot/doclib/doclist/all/site/'; + private _host: string = 'http://127.0.0.1:8080'; + private _baseUrlPath: string = '/alfresco/service/slingshot/doclib/doclist/all/site/'; + + public get host():string { + return this._host; + } + + public set host(value:string) { + this._host = value; + } + + private getBaseUrl():string { + return this.host + this._baseUrlPath; + } getFolder(folder: string) { let headers = new Headers({ @@ -18,7 +30,7 @@ export class AlfrescoService { }); let options = new RequestOptions({ headers: headers }); return this.http - .get(this._baseUrl + folder, options) + .get(this.getBaseUrl() + folder, options) .map(res => res.json()) .do(data => console.log(data)) // eyeball results in the console .catch(this.handleError);