Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you could try by passing the controller of the parent directive to the child, the values will be bound at the same time in both directives. I made an example here : <a href="http://jsfiddle.net/DotDotDot/pVYL6/3/" rel="nofollow">http://jsfiddle.net/DotDotDot/pVYL6/3/</a> (I couldn't use your code so I used something shorter)</p> <p>Actually, I added a controller to the first directive (your <code>resource</code>directive) where I define some getters : </p> <pre><code>.directive('parent',function(){ return { scope:{action:'@'}, controller: function($scope, $element, $attrs) { this.getAction=function(){ return $scope.action; } } } }); </code></pre> <p>The directive gets the action in the parameters, and this action can be accessed by <code>getAction()</code>. I use <code>this</code> instead of <code>$scope</code> because the goal is to use the controller in another directive. You can still add all your code of the <code>resource</code> directive, just add a getter in the controller.<br> Then, in the child directive, your <code>formajax</code>, you will require the parent directive controller, and pass it in the link function : </p> <pre><code>.... require:'^parent', link:function(scope, elt, attr, parentCtrl){ scope.$watch(function(){ scope.childaction=parentCtrl.getAction() }); </code></pre> <p>Edit : you still have to $watch the changes<br> Now you can access all your values from the parent directive in the child one</p> <p>I hope this will help you,</p> <p>Have fun</p>
    singulars
    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.
    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