Users Pricing

forum

Home Forums How to pass value one page to another page using angularjs? – MindStick

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

Anonymous User 15027 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>


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md