Get Verification Code Interface effect
You need to implement the following logic
button is not selectable
--Enter phone number, button optional
--Click to get, enter the countdown, button is not selectable
-Countdown to the end, back to the first state of knowledge
Core code:
var cd =; var function () { cd--; = "Regain" +1000, 60);
Full code:
Html:
<formname= "form"class= "Form-validation"> <Divclass= "List-group list-group-sm"> <Divclass= "List-group-item"> <inputtype= "text"placeholder= "Phone"class= "Form-control no-border"Ng-model= "Seller.phone"Required> </Div> <Divclass= "List-group-item"> <inputstyle= "width:150px;float:left;border:1px solid #DDD;"type= "Phone"placeholder= "4-bit verification Code"class= "Form-control no-border"Ng-model= "Seller.verification"Required> <Buttonstyle= "width:150px;float:right;"type= "button"class= "btn btn-primary btn-block"Ng-click= "sendverification ()"ng-disabled= '!seller.phone| | Send '>{{countdown}}</Button> <Divclass= "Clearfix"></Div> </Div> <Divclass= "List-group-item"> <inputtype= "Password"placeholder= "Password"class= "Form-control no-border"Ng-model= "Seller.password"Required> </Div> </Div></form>
Js:
App.controller (' Signupformcontroller ', [' $interval ', ' $scope ', ' $http ', ' $state ',function($interval, $scope, $http, $state) {$scope. Countdown= "Get Verification Code"; $scope. Loginmsg=""; $scope. Send=false; $scope. Sendverification=function() {$http. Post (' http://localhost:8083/boronManager/seller/verification/' + $scope. Seller.phone, {verificationtype:1}). Then (function(response) {varreq =Response.data; if(!req.success) $scope. Autherror=Req.error; }, function(x) {$scope. Autherror=Response.data.error; }); varcd = 60; varToDo =function() {$scope. Send=true; CD--; if(CD < 0) {CD= ""; $scope. Send=false; } $scope. Countdown= "Get back" +cd; }; $interval (ToDo,1000, 60); };}]);
Angular.js using the Get Verification Code button Implementation-Countdown