AngularJS Form Validation
How do I make an angularjs form validation?
What is a angularjs form validation? How do you make a angularjs form validation? This script and codes were developed by Fabio Biondi on 13 October 2022, Thursday.
AngularJS Form Validation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>AngularJS Form Validation</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <body ng-app ng-controller="LoginValidators" ng-class="{fullPageError: !myForm.$valid}"> <h2>AngularJS form and field validation</h2> <form name="myForm" class="jumbotron"> <!-- ALERT MSG --> <div class="alert alert-danger" ng-show="showAlert"> {{alertMsg}} <button class="btn btn-warning" ng-click="closeAlert()">x</button> </div> <!-- LOGIN PANEL --> <div ng-show="!showAlert"> <input type="text" name="user" ng-model="username" required placeholder="Username (required)" ng-class="{error: myForm.user.$invalid}"/><BR> <input type="password" name="pass" ng-model="password" required ng-minlength="5" placeholder="Password (min 5 chars)" ng-class="{error: myForm.pass.$invalid}" /><BR> <button class="btn btn-success" ng-click="send()" ng-disabled="myForm.$invalid">Send</button> </div> </form> <h4>Form $valid: {{myForm.$valid}}</h4> <h4>Form user $error: {{myForm.user.$error}}</h4> <h4>Form user $invalid: {{myForm.user.$invalid}}</h4> <h4>Form pass $error: {{myForm.pass.$error}}</h4> <script src="https://code.angularjs.org/1.2.6/angular.min.js"></script>
</body> <script src="js/index.js"></script>
</body>
</html>
AngularJS Form Validation - Script Codes CSS Codes
body
{ background-color: #0a8b00;
}
.fullPageError
{ background-color: #ff1500 !important;
}
.error
{ background-color: #ff1c37; color: #fff;
}
AngularJS Form Validation - Script Codes JS Codes
function LoginValidators($scope) { // hide Alert by default $scope.showAlert = false; $scope.send = function () { // Show Alert $scope.showAlert = true; // Custom Alert message $scope.alertMsg = $scope.username + " is now Logged"; } $scope.closeAlert = function () { $scope.showAlert = false; $scope.username = ""; $scope.password = ""; }
}
Developer | Fabio Biondi |
Username | fabiobiondi |
Uploaded | October 13, 2022 |
Rating | 3 |
Size | 2,249 Kb |
Views | 36,432 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
AngularJS - Day 1 - Boilerplate | 1,556 Kb |
AngularJS Directive - YouTube DATA API example | 2,309 Kb |
FlexBox - Grid 2 rows with different columns | 1,775 Kb |
D3 Pack Layout with transitions and tooltips | 3,981 Kb |
Responsive DOM elements distribution with D3 and Scales | 3,323 Kb |
D3.js Multi-Foci Force layout animated example | 2,845 Kb |
AngularJS 1.2.x - FullScreen Directive | 3,059 Kb |
Resizable directive in AngularJS and jQueryUI | 2,265 Kb |
FlexBox - Grid 2x2 | 1,685 Kb |
Realtime todo-list in AngularJS and Firebase in 20 lines | 2,432 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
RWD Conversion Practice | Jxqr97 | 2,743 Kb |
Knob rotation | Alemesre | 2,122 Kb |
Flex Chart | James_zedd | 4,111 Kb |
Yuliya v krylova | Rafszul | 37,351 Kb |
Blank Starter | Mhartington | 2,171 Kb |
A Pen by Ben Babics | Benbabics | 2,957 Kb |
Tumblr API | Juanv911 | 2,436 Kb |
Dice | Fraina | 5,026 Kb |
Import shader in three.js | Khangeldy | 2,636 Kb |
Stylize Stories | Jvhti | 2,465 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!