# Alfresco Social Component for Angular 2

travis
    Status travis
    Status Coverage Status npm downloads license alfresco component angular 2 typescript node version

## Prerequisites Before you start using this development framework, make sure you have installed all required software and done all the necessary configuration [prerequisites](https://github.com/Alfresco/alfresco-ng2-components/blob/master/PREREQUISITES.md). ## Install Follow the 3 steps below: 1. Npm ```sh npm install ng2-alfresco-social --save ``` 2. Html Include these dependencies in your index.html page: ```html ``` 3. SystemJs Add the following components to your systemjs.config.js file: - ng2-translate - alfresco-js-api - ng2-alfresco-core - ng2-alfresco-social Please refer to the following example file: [systemjs.config.js](demo/systemjs.config.js) . #### Basic usage In this component are present two different components : * adf-like * adf-rating ## adf-like ```html ``` ```ts 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'; import { SocialModule } from 'ng2-alfresco-social'; @Component({ selector: 'alfresco-app-demo', template: ` ` }) class LikeDemo { constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) { settingsService.ecmHost = 'http://localhost:8080'; this.authService.login('admin', 'admin').subscribe( ticket => { console.log(ticket); }, error => { console.log(error); }); } } @NgModule({ imports: [ BrowserModule, CoreModule.forRoot(), SocialModule ], declarations: [ LikeDemo ], bootstrap: [ LikeDemo ] }) export class AppModule { } platformBrowserDynamic().bootstrapModule(AppModule); ``` ### Options Attribute | Options | Default | Description | Mandatory --- | --- | --- | --- | --- `nodeId` | *string* | | The identifier of a node.| #### Events | Name | Description | | --- | --- | | `changeVote` | The event is emitted when vote change | ![Custom columns](docs/assets/social1.png) ## adf-rating ```html ``` ```ts 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'; import { SocialModule } from 'ng2-alfresco-social'; @Component({ selector: 'alfresco-app-demo', template: `