diff --git a/ng2-components/ng2-alfresco-tag/demo/src/main.ts b/ng2-components/ng2-alfresco-tag/demo/src/main.ts index 36585d7f1d..254108b4c7 100644 --- a/ng2-components/ng2-alfresco-tag/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-tag/demo/src/main.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { NgModule, Component, Input } from '@angular/core'; +import { NgModule, Component, Input, OnInit } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; @@ -29,10 +29,14 @@ import { TagModule } from 'ng2-alfresco-tag';



+
+ Authentication failed to ip {{ ecmHost }} with user: admin, admin, you can still try to add a valid ticket to perform + operations. +



-
+
List Tags ECM
@@ -44,13 +48,13 @@ import { TagModule } from 'ng2-alfresco-tag';
` }) -class TagDemo { +class TagDemo implements OnInit { @Input() - nodeId: string = 'a892714b-56ac-4b42-8b43-db0fa01eef33'; + nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d'; authenticated: boolean; - ecmHost: string = 'http://localhost:8181/share/proxy'; + ecmHost: string = 'http://127.0.0.1:8080'; ticket: string; constructor(private authService: AlfrescoAuthenticationService, @@ -66,12 +70,30 @@ class TagDemo { } } + ngOnInit() { + this.login(); + } + + login() { + this.authService.login('admin', 'admin').subscribe( + ticket => { + this.logService.info(ticket); + this.ticket = this.authService.getTicketEcm(); + this.authenticated = true; + }, + error => { + this.logService.error(error); + this.authenticated = false; + }); + } + public updateTicket(): void { this.storage.setItem('ticket-ECM', this.ticket); } public updateHost(): void { this.settingsService.ecmHost = this.ecmHost; + this.login(); } logData(data) {