0
var mainApp=angular.module('myMainApp',['ngRoute']);
mainApp.config(['$routeProvider',function($routeProvider){

    $routeProvider.when('/showData',{
    templateUrl:'C:/Users/Lala/Desktop/angularjs_lala/PassDatatoAnotherSecondPage.html',
    controller:'MainPageController'
    }).

     otherwise({
    redirectTo: 'file:///C:/Users/Lala/Desktop/angularjs_lala/PassDatatoAnotherPage.html'
  });
  }]);

        mainApp.controller('MainPageController',['$scope',function($scope){         

        console.log("In controller");

        $scope.SubmitData=function(user){

            console.log("In function");
            $scope.userData={
                  Fname:user.name,
                  Lname:user.surname,
                  Mobno:user.Mobno,
                  City:user.city
            };
            console.log($scope.userData);
            //$state.go('file:///CC:/Users/Lala/Desktop/angularjs_lala/SubmitPassedData.html');
        };
    }]);
Vikrant
  • 4,920
  • 17
  • 48
  • 72

1 Answers1

0

You can do pass data in multiple ways.

  1. localStorage of the browser
  2. URL parameters
  3. Server-side session
  4. Cookies, outdated and inefficient nowadays.

You can refer below link for detail.

How to pass data from one html page to another in angularJS?

Community
  • 1
  • 1
Hemal
  • 124
  • 1
  • 13