Ionic: Passing Array Elements Between Controllers


I have a controller & view which computes and displays a specific element. When I click a button on the view, I want to open another which shows more information about the item.

What is the best way to pass the element to another controller for display?

Many thanks

You could build a service which get data from one controller and passing it to the other, like so:

.factory('shareData', function(){

    var finalData;
    return {
        sendData: function(data) {
            finalData = data;
        getData: function() {
            return finalData;

Another option you have is to create a shared varraible in your main controller('app' controller in ionic)

.controller('app', function($scope){
.controller('app.controller1', function($scope){
    $ = "Hello World";
.controller('app.controller2', function($scope){
    console.log($; //Hello World