mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
2.1 KiB
2.1 KiB
Alfresco Login Component for Angular 2
Install
npm set registry http://devproducts.alfresco.me:4873
npm install --save ng2-alfresco-core ng2-alfresco-login
Build from sources
Alternatively you can build component from sources with the following commands:
npm install
npm run build
Components included:
- Alfresco Login Component
- Alfresco Authentication Service
Custom Login Component
import {Component} from 'angular2/core';
import {AlfrescoLoginComponent} from 'ng2-alfresco-login/ng2-alfresco-login';
@Component({
selector: 'my-login',
template: ' <alfresco-login method="{{methodName}}" (onSuccess)="mySuccessMethod($event)" (onError)="myErrorMethod($event)"></alfresco-login>',
directives: [ALFRESCO_LOGIN_DIRECTIVES]
})
export class MyLoginComponent {
methodName: string = 'POST';
mySuccessMethod($event) {
console.log('Success Login EventEmitt called with: '+$event.value);
}
myErrorMethod($event) {
console.log('Error Login EventEmitt called with: '+$event.value);
}
}
Demo
Configuring development environment
All scripts assume you are at the project root folder
Install symlinks for Alfresco components
ng2-alfresco-core:
cd ng2-components/ng2-alfresco-core
npm link
cd ../ng2-alfresco-login/demo
npm link ng2-alfresco-core
ng2-alfresco-login component:
cd ng2-components/ng2-alfresco-login
npm link
cd ../ng2-alfresco-login/demo
npm link ng2-alfresco-login
Start the demo
cd demo
npm install
npm start
Running unit tests
npm test
This task rebuilds all the code, runs tslint, license checks and other quality check tools before performing unit testing.
Code coverage
npm run coverage