mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
test login demo
This commit is contained in:
parent
654321780d
commit
74e89cef1e
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*!
|
||||||
* @license
|
* @license
|
||||||
* Copyright 2016 Alfresco Software, Ltd.
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
*
|
*
|
@ -86,40 +86,23 @@ main.ts
|
|||||||
```ts
|
```ts
|
||||||
|
|
||||||
import { bootstrap } from 'angular2/platform/browser';
|
import { bootstrap } from 'angular2/platform/browser';
|
||||||
import { AppComponent } from './components/app-component';
|
import { Component } from 'angular2/core';
|
||||||
import { ALFRESCO_AUTHENTICATION } from 'ng2-alfresco-login/dist/ng2-alfresco-login';
|
import { Router, RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router';
|
||||||
|
import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||||
|
import { AlfrescoLoginComponent } from 'ng2-alfresco-login/dist/ng2-alfresco-login';
|
||||||
import { ROUTER_PROVIDERS } from 'angular2/router';
|
import { ROUTER_PROVIDERS } from 'angular2/router';
|
||||||
import { HTTP_PROVIDERS } from 'angular2/http';
|
import { HTTP_PROVIDERS } from 'angular2/http';
|
||||||
import { ALFRESCO_CORE_PROVIDERS, AlfrescoTranslationService, AlfrescoTranslationLoader } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
import { ALFRESCO_CORE_PROVIDERS, AlfrescoTranslationService, AlfrescoTranslationLoader } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||||
|
|
||||||
bootstrap(AppComponent, [
|
|
||||||
ROUTER_PROVIDERS,
|
|
||||||
HTTP_PROVIDERS,
|
|
||||||
AlfrescoTranslationLoader,
|
|
||||||
AlfrescoTranslationService,
|
|
||||||
ALFRESCO_AUTHENTICATION,
|
|
||||||
ALFRESCO_CORE_PROVIDERS
|
|
||||||
]);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
app-components.ts
|
|
||||||
```ts
|
|
||||||
|
|
||||||
import { Component } from 'angular2/core';
|
|
||||||
import { AlfrescoLoginComponent, AlfrescoAuthenticationService } from 'ng2-alfresco-login/dist/ng2-alfresco-login';
|
|
||||||
import { Router, RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router';
|
|
||||||
import { AlfrescoSettingsService } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'my-login',
|
|
||||||
template: '<alfresco-login method="POST" (onSuccess)="mySuccessMethod($event)" (onError)="myErrorMethod($event)"></alfresco-login>',
|
|
||||||
directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent]
|
|
||||||
})
|
|
||||||
|
|
||||||
@RouteConfig([
|
@RouteConfig([
|
||||||
{path: '/', name: 'Login', component: AlfrescoLoginComponent, useAsDefault: true}
|
{path: '/', name: 'Login', component: AlfrescoLoginComponent, useAsDefault: true}
|
||||||
])
|
])
|
||||||
|
@Component({
|
||||||
|
selector: 'my-app',
|
||||||
|
template: '<alfresco-login method="POST" (onSuccess)="mySuccessMethod($event)" (onError)="myErrorMethod($event)"></alfresco-login>',
|
||||||
|
directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent]
|
||||||
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
|
||||||
constructor(public auth: AlfrescoAuthenticationService,
|
constructor(public auth: AlfrescoAuthenticationService,
|
||||||
@ -139,6 +122,15 @@ export class AppComponent {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bootstrap(AppComponent, [
|
||||||
|
ROUTER_PROVIDERS,
|
||||||
|
HTTP_PROVIDERS,
|
||||||
|
AlfrescoTranslationLoader,
|
||||||
|
AlfrescoTranslationService,
|
||||||
|
AlfrescoAuthenticationService,
|
||||||
|
ALFRESCO_CORE_PROVIDERS
|
||||||
|
]);
|
||||||
|
|
||||||
```
|
```
|
||||||
#### Events
|
#### Events
|
||||||
**onSuccess**: The event is emitted when the login is done
|
**onSuccess**: The event is emitted when the login is done
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Angular 2 Testing</title>
|
<title>Alfresco Angular 2 Testing - Demo</title>
|
||||||
<base href="/">
|
<base href="/">
|
||||||
|
|
||||||
<!-- Google Material Design Lite -->
|
<!-- Google Material Design Lite -->
|
||||||
@ -31,7 +31,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<my-login></my-login>
|
<my-app></my-app>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"author": "Alfresco Software, Ltd.",
|
"author": "Alfresco Software, Ltd.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "npm run build && npm run typings",
|
"postinstall": "npm run typings && npm run typings",
|
||||||
"typings": "typings install",
|
"typings": "typings install",
|
||||||
"start": "rm -rf dist && npm install && npm run server",
|
"start": "rm -rf dist && npm install && npm run server",
|
||||||
"server": "lite-server",
|
"server": "lite-server",
|
||||||
@ -16,6 +16,22 @@
|
|||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Denys Vuika",
|
||||||
|
"email": "denis.vuyka@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mario Romano",
|
||||||
|
"email": "mario.romano83@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Will Abson",
|
||||||
|
"email": "will.abson@alfresco.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Eugenio Romano",
|
||||||
|
"email": "eugenio.romano@alfresco.com"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Maurizio Vitale",
|
"name": "Maurizio Vitale",
|
||||||
"email": "maurizio.vitale@alfresco.com"
|
"email": "maurizio.vitale@alfresco.com"
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
///<reference path="../../node_modules/angular2/typings/browser.d.ts"/>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright 2016 Alfresco Software, Ltd.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Component } from 'angular2/core';
|
|
||||||
import { AlfrescoLoginComponent, AlfrescoAuthenticationService } from 'ng2-alfresco-login/dist/ng2-alfresco-login';
|
|
||||||
import { Router, RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router';
|
|
||||||
import { AlfrescoSettingsService } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'my-login',
|
|
||||||
template: '<alfresco-login method="POST" (onSuccess)="mySuccessMethod($event)" (onError)="myErrorMethod($event)"></alfresco-login>',
|
|
||||||
directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent]
|
|
||||||
})
|
|
||||||
|
|
||||||
@RouteConfig([
|
|
||||||
{path: '/', name: 'Login', component: AlfrescoLoginComponent, useAsDefault: true}
|
|
||||||
])
|
|
||||||
export class AppComponent {
|
|
||||||
|
|
||||||
constructor(public auth: AlfrescoAuthenticationService,
|
|
||||||
public router: Router,
|
|
||||||
alfrescoSettingsService: AlfrescoSettingsService) {
|
|
||||||
alfrescoSettingsService.host = 'http://192.168.99.100:8080';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
mySuccessMethod($event) {
|
|
||||||
console.log('Success Login EventEmitt called with: ' + $event.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
myErrorMethod($event) {
|
|
||||||
console.log('Error Login EventEmitt called with: ' + $event.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*!
|
||||||
* @license
|
* @license
|
||||||
* Copyright 2016 Alfresco Software, Ltd.
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
*
|
*
|
||||||
@ -16,17 +16,47 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { bootstrap } from 'angular2/platform/browser';
|
import { bootstrap } from 'angular2/platform/browser';
|
||||||
import { AppComponent } from './components/app-component';
|
import { Component } from 'angular2/core';
|
||||||
import { ALFRESCO_AUTHENTICATION } from 'ng2-alfresco-login/dist/ng2-alfresco-login';
|
import { Router, RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router';
|
||||||
|
import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||||
|
import { AlfrescoLoginComponent } from 'ng2-alfresco-login/dist/ng2-alfresco-login';
|
||||||
import { ROUTER_PROVIDERS } from 'angular2/router';
|
import { ROUTER_PROVIDERS } from 'angular2/router';
|
||||||
import { HTTP_PROVIDERS } from 'angular2/http';
|
import { HTTP_PROVIDERS } from 'angular2/http';
|
||||||
import { ALFRESCO_CORE_PROVIDERS, AlfrescoTranslationService, AlfrescoTranslationLoader } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
import { ALFRESCO_CORE_PROVIDERS, AlfrescoTranslationService, AlfrescoTranslationLoader } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||||
|
|
||||||
|
|
||||||
|
@RouteConfig([
|
||||||
|
{path: '/', name: 'Login', component: AlfrescoLoginComponent, useAsDefault: true}
|
||||||
|
])
|
||||||
|
@Component({
|
||||||
|
selector: 'my-app',
|
||||||
|
template: '<alfresco-login method="POST" (onSuccess)="mySuccessMethod($event)" (onError)="myErrorMethod($event)"></alfresco-login>',
|
||||||
|
directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent]
|
||||||
|
})
|
||||||
|
export class AppComponent {
|
||||||
|
|
||||||
|
constructor(public auth: AlfrescoAuthenticationService,
|
||||||
|
public router: Router,
|
||||||
|
alfrescoSettingsService: AlfrescoSettingsService) {
|
||||||
|
alfrescoSettingsService.host = 'http://192.168.99.100:8080';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mySuccessMethod($event) {
|
||||||
|
console.log('Success Login EventEmitt called with: ' + $event.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
myErrorMethod($event) {
|
||||||
|
console.log('Error Login EventEmitt called with: ' + $event.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bootstrap(AppComponent, [
|
bootstrap(AppComponent, [
|
||||||
ROUTER_PROVIDERS,
|
ROUTER_PROVIDERS,
|
||||||
HTTP_PROVIDERS,
|
HTTP_PROVIDERS,
|
||||||
AlfrescoTranslationLoader,
|
AlfrescoTranslationLoader,
|
||||||
AlfrescoTranslationService,
|
AlfrescoTranslationService,
|
||||||
ALFRESCO_AUTHENTICATION,
|
AlfrescoAuthenticationService,
|
||||||
ALFRESCO_CORE_PROVIDERS
|
ALFRESCO_CORE_PROVIDERS
|
||||||
]);
|
]);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES5",
|
"target": "es5",
|
||||||
"module": "commonjs",
|
"module": "system",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
@ -11,8 +11,9 @@
|
|||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
"dist",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"typings",
|
"typings/main",
|
||||||
"dist"
|
"typings/main.d.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user