Simple Multi Step Form with validation Using AngularJS

Simple Multi Step Form with validation Using AngularJS

In this Post We Will Explain About is Simple Multi Step Form with validation Using AngularJS With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to AngularJS Multi-Step Form Using UI Router Example

In this post we will show you Best way to implement AngularJS 1.5.x Multi-Step Form, hear for How to make multi step form in Angularjs with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

External Include file

AngularJS is a simple JavaScript framework Include one type of the (library) based on a very user friedly popular software mvc based architecture menas called the MVC.

   

index.html

The Angular simple directives and the User’s view HTML DOM in a web-application page form the HTML view. In our example(Pakainfo.com), the simple HTML view comprises the HTML All the element, and then simple two angular directives Like as a namely angular ng-app as well as agular ng-controller




  
 

AngularJS 1.5.x Multi-Step Form

Welcome to Pakainfo.com - the form.

Max character length reached.
Max character length reached.
Incorrect email format. Please Max character length reached.
Incorrect Your email format. Please Max character length reached.

Summary

First name: {{liveparam.userFname}}

Last name: {{liveparam.userLname}}

Email: {{liveparam.email}}

Message Body: {{liveparam.messageBody}}

Thank you

Your message has been sent.
You should receive a confirmation email.

Error

There was an error when attempting to submit your request.
Please try again later.

*This will always error until a web service URL is set.*

 
 
 {{ liveparam | json }}

 

 
  • Form Invalid
  • Form Valid
  • {{ key }} errors
    • {{ e.$name }} has an error: {{ key }}.

index.js

The simple angular controller works as a all the data of the mediator between HTML views and models.

'use strict';

angular.module('liveApp', [
  'ngAnimate'
]).
controller('liveCtrl', ['$scope', '$http', function($scope, $http) {
  $scope.liveparam = {};
  $scope.phase = "";
  $scope.liveValidate = false;
  $scope.btnToggleJson = false;
  $scope.generateError = false;
  
  $scope.liveparam = {
    otherEmail: '',
    otherEmailList: []
  };
  
  // Navigation functions
  $scope.next = function (phase) {
    //$scope.mulridir = 1;
    //$scope.phase = phase;
    
    $scope.liveValidate = true;
    
    if ($scope.StepByStepFrm.$valid) {
      $scope.mulridir = 1;
      $scope.phase = phase;
      $scope.liveValidate = false;
    }
  };

  $scope.back = function (phase) {
    $scope.mulridir = 0;
    $scope.phase = phase;
  };
  
  // Other email list functions
  $scope.addOtherEmail = function () {
    $scope.userRId++;

    var email = {
      email: $scope.liveparam.otherEmail,
      userrow_id: $scope.userRId
    };

    $scope.liveparam.otherEmailList.push(email);

    $scope.liveparam.otherEmail = '';
  };

  $scope.removeCCEmail = function (userrow_id) {
    for (var i = 0; i < $scope.liveparam.otherEmailList.length; i++) {
      if ($scope.liveparam.otherEmailList[i].userrow_id === userrow_id) {
        $scope.liveparam.otherEmailList.splice(i, 1);
        break;
      }
    }
  };
  
  
  // Post to desired exposed web service.
  $scope.submitForm = function () {
    var myurl = "https://www.pakainfo.com/";

    // Check form validity and submit data using $http
    if ($scope.StepByStepFrm.$valid) {
      $scope.liveValidate = false;

      $http({
        method: 'POST',
        url: myurl,
        data: JSON.stringify($scope.liveparam)
      }).then(function successCallback(results) {
        if (results
          && results.data
          && results.data.status
          && results.data.status === 'success') {
          $scope.phase = "success";
        } else {
          if (results
            && results.data
            && results.data.status
            && results.data.status === 'error') {
            $scope.phase = "error";
          }
        }
      }, function errorCallback(results) {
        $scope.phase = "error";
        console.log(results);
      });
    }
  };
  
  $scope.reset = function() {
    // Clean up scope before destorying
    $scope.liveparam = {};
    $scope.phase = "";
  }
}]);

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Angularjs multi step form validation

Multi-Step Form in Angular

I hope you have Got What is Multi Step Form with Progress Bar using Angularjs and CSS3 And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Comment