From c1353bdcca49003225bc9258c8d9b388bfcf7c09 Mon Sep 17 00:00:00 2001 From: Mario Romano Date: Wed, 9 Nov 2016 14:21:24 +0000 Subject: [PATCH] #878 code documentation --- ng2-components/ng2-alfresco-core/README.md | 55 +++++++++++++--------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/ng2-components/ng2-alfresco-core/README.md b/ng2-components/ng2-alfresco-core/README.md index 616e997f0b..9420f87679 100644 --- a/ng2-components/ng2-alfresco-core/README.md +++ b/ng2-components/ng2-alfresco-core/README.md @@ -66,8 +66,6 @@ npm install --save ng2-alfresco-core Provides access to initialized **AlfrescoJSApi** instance. ```ts -import { OnInit } from '@angular/core'; -import { AlfrescoApiService } from 'ng2-alfresco-core'; export class MyComponent implements OnInit { @@ -136,38 +134,44 @@ export class MyComponent implements OnInit { The authentication service is used inside the [login component](../ng2-alfresco-login) and is possible to find there an example of how to use it. ```ts -import { Component } from '@angular/core'; -import { bootstrap } from '@angular/platform-browser-dynamic'; -import { HTTP_PROVIDERS } from '@angular/http'; - -import { - ALFRESCO_CORE_PROVIDERS, - AlfrescoSettingsService, - AlfrescoAuthenticationService -} from 'ng2-alfresco-core'; +import { NgModule, Component } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +import { CoreModule, AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core'; @Component({ - selector: 'my-app', + selector: 'alfresco-app-demo', template: `
Authentication failed to ip {{ ecmHost }} with user: admin, admin
- Authentication successfull to ip {{ ecmHost }} with user: admin, admin, your token is {{ token }} +
ECM
+ Authentication successfull to ip {{ ecmHost }} with user: admin, admin
+ your token is {{ tokenEcm }}
+
BPM
+ Authentication successfull to ip {{ bpmHost }} with user: admin, admin
+ your token is {{ tokenBpm }}
` }) class MyDemoApp { authenticated: boolean = false; - ecmHost: string = 'http://127.0.0.1:8080'; + public ecmHost: string = 'http://localhost:8080'; - token: string; + public bpmHost: string = 'http://localhost:9999'; + + tokenBpm: string; + + tokenEcm: string; constructor(public alfrescoAuthenticationService: AlfrescoAuthenticationService, private alfrescoSettingsService: AlfrescoSettingsService) { alfrescoSettingsService.ecmHost = this.ecmHost; - alfrescoSettingsService.setProviders('ECM'); + alfrescoSettingsService.bpmHost = this.bpmHost; + + alfrescoSettingsService.setProviders('ALL'); } ngOnInit() { @@ -177,7 +181,8 @@ class MyDemoApp { login() { this.alfrescoAuthenticationService.login('admin', 'admin').subscribe( token => { - this.token = token.ticket; + this.tokenBpm = this.alfrescoAuthenticationService.getTicketBpm(); + this.tokenEcm = this.alfrescoAuthenticationService.getTicketEcm(); this.authenticated = true; }, error => { @@ -186,11 +191,19 @@ class MyDemoApp { }); } } -bootstrap(MyDemoApp, [ - HTTP_PROVIDERS, - ALFRESCO_CORE_PROVIDERS -]); +@NgModule({ + imports: [ + BrowserModule, + CoreModule.forRoot() + ], + declarations: [MyDemoApp], + bootstrap: [MyDemoApp] +}) +export class AppModule { +} + +platformBrowserDynamic().bootstrapModule(AppModule); ``` #### Renditions Service