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');
};
}]);
-
where is data you want pass ? You should use services for itAkashii– Akashii2017-05-08 06:23:16 +00:00Commented May 8, 2017 at 6:23
-
Try this solution stackoverflow.com/a/43700447/4116300Rohìt Jíndal– Rohìt Jíndal2017-05-08 08:00:50 +00:00Commented May 8, 2017 at 8:00
Add a comment
|
1 Answer
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?