Angular Dadan SDK
A lightweight Angular package used for checking, validating, and manipulating Google Dadan Extension with Angular.
Install
npm install angular-dadan-sdk
Or
yarn add angular-dadan-sdk
Usage
In app.module.ts import the following
import { VideosModule } from 'angular-dadan-sdk';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
VideosModule
],
providers: [],
bootstrap: [AppComponent]
});
export class AppModule { }
In app.component.html add the record button component with props
<lib-record-video-button
(onSuccess)="handleResponse($event)"
(onFailure)="handleResponse($event)"
title="Select Video"
type="select"
buttonClass="dd__record__button__default__class"
[buttonStyle]="{ color: '#1e3799', 'font-size': '15px' }"
[showSvg]="true"
[showPreview]="true"
[copyToClipboard]="true"
>
</lib-record-video-button>
In app.component.ts add the following
export class AppComponent {
title = 'angular-sample';
public videos : any[];
constructor(){
this.videos = [];
}
handleResponse($eventResult : any):void{
const {success, data, message} = $eventResult;
if (success) {
if (data) {
this.videos = data;
}
} else {
this.videos = [];
console.log(message);
}
}
}
the handleResponse function , is a callback function which accept object with three parameters
handleResponse($eventResult : any): void {
const {success, data, message} = $eventResult;
if (success) {
if (data) {
this.videos = data;
}
} else {
this.videos = [];
console.error(message);
}
}
Record Button Props
Parameter | Type | Description |
---|
type | string | Required. either record or select , else will show error |
title | string | Optional. button title |
buttonClass | string | Optional. the default class , or your custom class |
buttonStyle | object | Optional. the default style , or your custom style as string |
showSvg | boolean | Optional. to show Svg icon in button |
showPreview | boolean | Optional. to show preview dialog of recorded video |
copyToClipboard | boolean | Optional. to notify user that video shared url was copied to clipboard as toast message |
License
MIT