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');
};
}]);
Asked
Active
Viewed 361 times
0

Vikrant
- 4,920
- 17
- 48
- 72

Lala Jamadar
- 3
- 3
-
where is data you want pass ? You should use services for it – Akashii May 08 '17 at 06:23
-
Try this solution http://stackoverflow.com/a/43700447/4116300 – Debug Diva May 08 '17 at 08:00
1 Answers
0
You can do pass data in multiple ways.
- localStorage of the browser
- URL parameters
- Server-side session
- Cookies, outdated and inefficient nowadays.
You can refer below link for detail.
How to pass data from one html page to another in angularJS?