I have seen so many answers to pass one directive data to another directive in angularjs but nothing is working for me.
I have a directive(readDirectoryContents) to read directory contents by dragging and dropping folder. Now I want to display this directory contents in a tree structure using another directive(buildTree).
First I created a directive
<readDirectoryContents>
and then got $scope.files from this directive and now I created another directive
<buildTree>
in which I want to use $scope.files, so the problem here is both
<readDirectoryContents> and <buildTree>
are loading at the same time making $scope.files to be [] in
<buildTree> directive.
How to make
<buildTree> to wait executing until we get $scope.files from <readDirectoryContents>. I am using console.log($scope.files); in my
<buildTree> directive to display the "files" but it is always showing [] as <readDirectoryContents> and <buildTree> are getting executed at the same time.
Please remember that I am not asking about how to display $scope.files into UI, but I am asking about how to make execution of
<buildTree> wait until the <readDirectoryContents> directive execution is done.(just to get $scope.files from first directive to next).
This is something similar to make one promise to wait until we get the result from another promise but here I am asking in context of directives. How to make one directive execution wait until we get data from another directive.
Thanks in advance. I am using angularjs 1 in my code. My question is how to make console.log($scope.files) to do not display [] in
<buildTree> directive.
&binding to communicate events from a directive. Use one-way<binding to receive model values. Use the$onChangeslife-cycle hook to react to changes of the model.