How to implement on Angular

Installation

Install captcha wrapper with npm:

npm i @leminnow/ng-lemin-cropped-captcha
 

Also, you can install captcha wrapper with yarn:

yarn add @leminnow/ng-lemin-cropped-captcha

Integration

Import LeminCroppedCaptchaModule:

import {LeminCroppedCaptchaModule} from "@leminnow/ng-lemin-cropped-captcha";

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
LeminCroppedCaptchaModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}

Use LeminCroppedCaptcha in your component:

Lemin Captcha must be placed inside of a “form” element.

<form>
<!-- Your Captcha Id and Captcha Container Id -->
<lemin-cropped-captcha
containerId="..."
captchaId="CROPPED_..."
></lemin-cropped-captcha>
</form>

Usage Examples

Please ensure that your container-id is the same as the container-id you've set before. (default: "lemin-cropped-captcha")

Using with component ref:

<form>
<lemin-cropped-captcha
containerId="..."
captchaId="CROPPED_..."
></lemin-cropped-captcha>
</form>
<button (click)="getCaptchaValues()">Get Values</button>
import {LeminCroppedCaptchaComponent} from "@leminnow/ng-lemin-cropped-captcha";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
@ViewChild(LeminCroppedCaptchaComponent) leminCroppedCaptcha!: LeminCroppedCaptchaComponent;

constructor() {
}

getCaptchaValues() {
const values = this.leminCroppedCaptcha.getCaptchaValue();
}
}

Using with LeminCroppedCaptchaService:

<form>
<lemin-cropped-captcha
containerId="..."
captchaId="CROPPED_..."
></lemin-cropped-captcha>
</form>
<button (click)="getCaptchaValues()">Get Values</button>
import {LeminCroppedCaptchaService} from "@leminnow/ng-lemin-cropped-captcha";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(private leminCroppedCaptchaService: LeminCroppedCaptchaService) {
}

getCaptchaValues() {
const values = this.leminCroppedCaptchaService.getCaptcha('...').getCaptchaValue()
}
}