diff --git a/ng2-components/ng2-alfresco-login/demo/src/main.ts b/ng2-components/ng2-alfresco-login/demo/src/main.ts index 2f9b357e38..69fbe7886c 100644 --- a/ng2-components/ng2-alfresco-login/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-login/demo/src/main.ts @@ -30,26 +30,38 @@ import { ALFRESCO_CORE_PROVIDERS, AlfrescoTranslationService, AlfrescoTranslatio ]) @Component({ selector: 'my-app', - template: '', + template: `
+

+ {{ status }} +
+ `, directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent] }) export class AppComponent { - constructor(public auth: AlfrescoAuthenticationService, - public router: Router, - alfrescoSettingsService: AlfrescoSettingsService) { - alfrescoSettingsService.host = 'http://192.168.99.100:8080'; + public host: string = 'http://192.168.99.100:8080'; + public token: string; + + public status: string = ''; + + constructor(public auth: AlfrescoAuthenticationService, public router: Router, private alfrescoSettingsService: AlfrescoSettingsService) { + alfrescoSettingsService.host = this.host; + } + + public updateHost(): void { + this.alfrescoSettingsService.host = this.host; } mySuccessMethod($event) { console.log('Success Login EventEmitt called with: ' + $event.value); + this.status = $event.value; } myErrorMethod($event) { console.log('Error Login EventEmitt called with: ' + $event.value); + this.status = $event.value; } - } bootstrap(AppComponent, [ diff --git a/ng2-components/ng2-alfresco-upload/demo/src/main.ts b/ng2-components/ng2-alfresco-upload/demo/src/main.ts index d73a1b15c9..a90b91a14e 100644 --- a/ng2-components/ng2-alfresco-upload/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-upload/demo/src/main.ts @@ -15,28 +15,28 @@ * limitations under the License. */ -import { Component, OnInit } from 'angular2/core'; +import { Component, OnInit } from 'angular2/core'; import { bootstrap } from 'angular2/platform/browser'; import { HTTP_PROVIDERS } from 'angular2/http'; -import { - ALFRESCO_CORE_PROVIDERS, - AlfrescoSettingsService, - AlfrescoAuthenticationService -} from 'ng2-alfresco-core/dist/ng2-alfresco-core'; +import { + ALFRESCO_CORE_PROVIDERS, + AlfrescoSettingsService, + AlfrescoAuthenticationService +} from 'ng2-alfresco-core/dist/ng2-alfresco-core'; import { ALFRESCO_ULPOAD_COMPONENTS, UploadService } from 'ng2-alfresco-upload/dist/ng2-alfresco-upload'; @Component({ selector: 'my-app', - template: `
-
-
-

-
- Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid token to perform - operations. -
-
+ template: `
+
+
+

+
+ Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid token to perform + operations. +
+
- - `, + + `, directives: [ALFRESCO_ULPOAD_COMPONENTS] }) -export class MyDemoApp implements OnInit { - - authenticated: boolean; - - host: string = 'http://192.168.99.101:8080'; - +export class MyDemoApp implements OnInit { + + authenticated: boolean; + + host: string = 'http://192.168.99.100:8080'; + token: string; - constructor(private authService: AlfrescoAuthenticationService, private alfrescoSettingsService: AlfrescoSettingsService) { - alfrescoSettingsService.host = this.host; + constructor(private authService: AlfrescoAuthenticationService, private alfrescoSettingsService: AlfrescoSettingsService) { + alfrescoSettingsService.host = this.host; if (localStorage.getItem('token')) { this.token = localStorage.getItem('token'); } } - public updateToken(): void { + public updateToken(): void { localStorage.setItem('token', this.token); } - public updateHost(): void { - this.alfrescoSettingsService.host = this.host; - } - + public updateHost(): void { + this.alfrescoSettingsService.host = this.host; + } + public customMethod(event: Object): void { console.log('File uploaded'); } - - public ngOnInit(): void { - this.login(); - } - - public login(): void { - this.authService.login('admin', 'admin').subscribe(token => { - this.authenticated = true; - }); - } + + public ngOnInit(): void { + this.login(); + } + + public login(): void { + this.authService.login('admin', 'admin').subscribe(token => { + this.authenticated = true; + }); + } } bootstrap(MyDemoApp, [ HTTP_PROVIDERS, - ALFRESCO_CORE_PROVIDERS, + ALFRESCO_CORE_PROVIDERS, UploadService ]);