angularjs - Ionic: Passing array elements between controllers -


i have controller & view computes , displays specific element. when click button on view, want open shows more information item.

what best way pass element controller display?

many thanks

you build service data 1 controller , passing other, so:

.factory('sharedata', function(){      var finaldata;     return {         senddata: function(data) {             finaldata = data;         },         getdata: function() {             return finaldata;         }     } }); 

another option have create shared varraible in main controller('app' controller in ionic)

.controller('app', function($scope){     $scope.data; }) .controller('app.controller1', function($scope){     $scope.data = "hello world"; }) .controller('app.controller2', function($scope){     console.log($scope.data); //hello world }); 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -