BotDetect CAPTCHA AngularJS Module (JavaScript: Angular 1.x)
For a comprehensive step-by-step integration guide please see our AngularJS Captcha Module Integration Guide.
The guide covers the integration with the following backends:
- ASP.NET (Core): web API with MVC Core
- ASP.NET (Legacy): Web-API2, MVC1-5, Generic Handler
- Java: Servlet, Spring, Struts
- PHP: the plain PHP
To give you a hint how AngularJS Captcha Module works we pasted bellow a few, not necessary up-to-date (and mostly frontend related), excerpts from the Integration Guide.
Quick guide:
1) AngularJS Captcha Module Installation
npm install angularjs-captcha --save
2) Include AngularJS Captcha Module in Your App
3) Inject AngularJS Captcha Module to Your AngularJS App, and Configure Backend Captcha Endpoint
Endpoint configuration depends on which technology you use in the backend.
- ASP.NET-based captcha endpoint:
var app = angular; app;
- Java-based captcha endpoint:
var app = angular; app;
- PHP-based captcha endpoint:
var app = angular; app;
4) Display Captcha In Your AngularJS Template
5) Captcha Validation: Client-side Code
app;
6) Captcha Validation: Server-side Code
The userEnteredCaptchaCode
and captchaId
values posted from the frontend are used to validate a captcha challenge on the backend.
The validation is performed by calling the: Validate(userEnteredCaptchaCode, captchaId)
.
- Server-side Captcha validation with ASP.NET Captcha looks in this way:
// C#SimpleCaptcha yourFirstCaptcha = new SimpleCaptcha();bool isHuman = yourFirstCaptcha.Validate(userEnteredCaptchaCode, captchaId);
' VB.NETDim yourFirstCaptcha As SimpleCaptcha = New SimpleCaptcha()Dim isHuman As Boolean = yourFirstCaptcha.Validate(userEnteredCaptchaCode, captchaId)
- Server-side Captcha validation with Java Captcha looks in this way:
SimpleCaptcha yourFirstCaptcha = SimpleCaptcha.;boolean isHuman = yourFirstCaptcha.;
- Server-side Captcha validation with PHP Captcha looks in this way:
$yourFirstCaptcha = new SimpleCaptcha();$isHuman = $yourFirstCaptcha->Validate($userEnteredCaptchaCode, $captchaId);
Documentation:
-
AngularJS Captcha Module Step-by-step Integration Guide -- read this one first
-
AngularJS Captcha Module Basic Example -- partial code walk-through
-
AngularJS Captcha Module Form Example -- partial code walk-through
Dependencies:
The current version of the AngularJS Captcha Module requires one of the following BotDetect CAPTCHA backends:
Technical Support:
Through contact form on captcha.com.