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 User1445617-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

<ahref="#/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>


Updated on 17-Mar-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By