Reputation: 63
Actually I am trying to fill a form in angularjs and its data is recieved in one of the controller...i need to pass the same data to another controller which is needed to be shown on the another web page
Upvotes: 2
Views: 48
Reputation: 222722
You should make use of angular service to do the same.
Create a service, that will hold model variables.
angular.service("dataService", function() {
this.value1 = "";
});
Then you can reference that service in your controllers,
angular.controller("myCntrl1", function($scope, dataService) {
$scope.value1 = dataService.value1;
});
angular.controller("myCntrl2", function($scope, dataService) {
$scope.value1 = dataService.value1;
});
Upvotes: 1