How to pass an object from a nested directive with isolated scope to parent controller scope in angular
<p>I have a directive treeview which contains a nested directive (being the branches) of each item rendered.</p>

<p>In the scope of both directives I have declared two parameters that should be talking to the parent controller. </p>

<p><code>filter: '&amp;'</code> //binds the method filter within the nested directive (branch) to the method doSomething() in the tree directive attribute which is bound to the html directive that binds to the controller.</p>

<p><code>iobj: '='</code> is the two way binding paramter that should be passing the scoped object to the controller. (but currently isn't)</p>

<p>Directive:</p>

<pre><code>app.directive('tree', function () {
    return {
        restrict: 'E', 
        replace: true,
        scope: {
            t: '=src',
            filter: '&amp;',
            iobj: '='
        },
        controller: 'treeController',
        template: '&lt;ul&gt;&lt;branch ng-repeat="c in t.children" iobj="object" src="c" filter="doSomething()"&gt;&lt;/branch&gt;&lt;/ul&gt;'
    };
});

app.directive('branch', function($compile) {

    return {
        restrict: 'E', 
        replace: true, 
        scope: {
            b: '=src',
            filter: '&amp;',
            iobj: '='
        },

        template: '&lt;li&gt;&lt;input type="checkbox" ng-click="innerCall()"  ng-hide="visible" /&gt;&lt;a&gt;{{ b.name }}&lt;/a&gt;&lt;/li&gt;',
        link: function (scope, element, attrs) {
           var has_children = angular.isArray(scope.b.children);
            scope.visible = has_children;
            if (has_children) {
                element.append('&lt;tree src="b"&gt;&lt;/tree&gt;');
                $compile(element.contents())(scope);
            }
            element.on('click', function(event) {
                event.stopPropagation();
                if (has_children) {
                    element.toggleClass('collapsed');
                }
            });
            scope.innerCall = function () {
                scope.iobj = scope.b;

                console.log(scope.iobj);
                scope.filter();
            }
        }
    };
});
</code></pre>

<p>HTML:</p>

<pre><code>&lt;div ng-controller="treeController"&gt;
    &lt;tree src="myList" iobj="object" filter="doSomething()"&gt;&lt;/tree&gt;

    &lt;a ng-click="clicked()"&gt; link&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>Controller:</p>

<pre><code>app.controller("treeController", ['$scope', function($scope) {
    var vm = this;

    $scope.object = {};
    $scope.doSomething = function () {
        var item = $scope.object;
        //alert('call from directive');
        console.log(item);
   }

   $scope.clicked = function () {
       alert('clicked');
   }
...
</code></pre>

<p>Currently I <strong>can</strong> invoke the function <code>$scope.doSomething</code> from the directive to the controller. So I know that I have access to the controllers scope from the directive. What I cannot figure out is how to pass an object as a parameter from the directive back to the controller. When I run this code, <code>$scope.object</code>
is always an empty object. </p>

<p>I'd appreciate any help or suggestions on how to go about this. </p>