mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
#878 code documentation
This commit is contained in:
parent
1dafba7a72
commit
c1353bdcca
@ -66,8 +66,6 @@ npm install --save ng2-alfresco-core
|
|||||||
Provides access to initialized **AlfrescoJSApi** instance.
|
Provides access to initialized **AlfrescoJSApi** instance.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { OnInit } from '@angular/core';
|
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
|
||||||
|
|
||||||
export class MyComponent implements OnInit {
|
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.
|
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
|
```ts
|
||||||
import { Component } from '@angular/core';
|
import { NgModule, Component } from '@angular/core';
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { HTTP_PROVIDERS } from '@angular/http';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
import { CoreModule, AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||||
import {
|
|
||||||
ALFRESCO_CORE_PROVIDERS,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoAuthenticationService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'alfresco-app-demo',
|
||||||
template: `
|
template: `
|
||||||
<div *ngIf="!authenticated" >
|
<div *ngIf="!authenticated" >
|
||||||
Authentication failed to ip {{ ecmHost }} with user: admin, admin
|
Authentication failed to ip {{ ecmHost }} with user: admin, admin
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="authenticated">
|
<div *ngIf="authenticated">
|
||||||
Authentication successfull to ip {{ ecmHost }} with user: admin, admin, your token is {{ token }}
|
<H5>ECM</H5>
|
||||||
|
Authentication successfull to ip {{ ecmHost }} with user: admin, admin<br>
|
||||||
|
your token is {{ tokenEcm }}<br>
|
||||||
|
<H5>BPM</H5>
|
||||||
|
Authentication successfull to ip {{ bpmHost }} with user: admin, admin<br>
|
||||||
|
your token is {{ tokenBpm }}<br>
|
||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
class MyDemoApp {
|
class MyDemoApp {
|
||||||
authenticated: boolean = false;
|
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,
|
constructor(public alfrescoAuthenticationService: AlfrescoAuthenticationService,
|
||||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||||
|
|
||||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||||
alfrescoSettingsService.setProviders('ECM');
|
alfrescoSettingsService.bpmHost = this.bpmHost;
|
||||||
|
|
||||||
|
alfrescoSettingsService.setProviders('ALL');
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -177,7 +181,8 @@ class MyDemoApp {
|
|||||||
login() {
|
login() {
|
||||||
this.alfrescoAuthenticationService.login('admin', 'admin').subscribe(
|
this.alfrescoAuthenticationService.login('admin', 'admin').subscribe(
|
||||||
token => {
|
token => {
|
||||||
this.token = token.ticket;
|
this.tokenBpm = this.alfrescoAuthenticationService.getTicketBpm();
|
||||||
|
this.tokenEcm = this.alfrescoAuthenticationService.getTicketEcm();
|
||||||
this.authenticated = true;
|
this.authenticated = true;
|
||||||
},
|
},
|
||||||
error => {
|
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
|
#### Renditions Service
|
||||||
|
Loading…
x
Reference in New Issue
Block a user