Note that there are some explanatory texts on larger screens.

plurals
  1. POPassing the result of a function to a directive
    primarykey
    data
    text
    <p>I have a list in controllerA - controllerA also has a function that determines if an item in that list has been imported. I'd like to pass this boolean into each of the listed objects' directives (so controllerB - the controller for each of the objects - can see if its object has been imported), but it's not working as I'd hoped.</p> <p>I have the following (simplified) in my HTML: </p> <pre><code>&lt;tbody&gt; &lt;tr objectpane object="object" objectIsImported="objectIsImported(object)"&gt;&lt;/tr&gt; &lt;/tbody&gt; </code></pre> <p>objectIsImported is supposed to be passing a boolean down to the objectPane instance.</p> <p>This view is paired to an ng-controller (controllerA) that has the following function defined: </p> <pre><code>$scope.objectIsImported = function(object) { alert("never gets hit"); }; </code></pre> <p>objectpane directive has this: </p> <pre><code>aoo.directive('objectpane', ['$log', function ($log) { return { restrict: 'A', templateUrl: '/App/objectmanager/objectpane.html', scope: { object: "=", objectIsImported: "=" }, controller: 'ObjectPaneController' }; }]); </code></pre> <p>Within ObjectPaneController (ControllerB) I have this: </p> <pre><code>$scope.alreadyImported = $scope.objectIsImported; // from scope in directive </code></pre> <p>The problem is that the $scope.objectIsImported from controllerA is not getting hit, ever. What am I doing wrong? Everything else is working between the controllers / directive, it's just that passing this function result down to the directive doesn't seem to be working.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload