Users Pricing

forum

home / developersection / forums / how to pass value one page to another page using angularjs?

How to pass value one page to another page using angularjs?

Anonymous User 14936 17 Mar 2015

In the following code I’m trying to change to another page on click and want to pass the object. How can I do it. In the following code I get it as undefined how to go about this

<a href="#/rel" ng-click="func(i)">{{i.display}}</a>
<script>
  
 
    app.controller("ctrls",['$scope','$location',function($scope,$location){
        $scope.func = function(i) {
            $scope.var=i
            $location.path("/rel");
        };
    });
 
app.controller("relctrls",'$scope',function($scope)   {
    console.log($scope.var) //undefined
});
</script>


I am a content writter !


1 Answers