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');
        };
    }]);
2
  • where is data you want pass ? You should use services for it Commented May 8, 2017 at 6:23
  • Try this solution stackoverflow.com/a/43700447/4116300 Commented May 8, 2017 at 8:00

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.