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
Post a Comment