I have a directive that look like this:
<div ng-controller="searchController" searchbar>
<input type="text" id="searchfield" ng-model="myVar">
<div searchresult>
<div ng-repeat="data in data.menu | filter: myVar">
{{data.title}}
</div>
</div>
</div>
There is one controller called searchController, and 2 directives called searchbar and searchresult.
How can I have the searchbar directive to run a function in searchresult directive? I was thinking to put require: "^searchresult" in searchbar directive and call it's function. Is that the correct way of doing? What if the searchresult is not available there?
Here is the detail scenario:
When user type in the input field, the search result update by the filter. Therefore the height of searchresult div is changed.
How can the searchresult directive knows about the changes of the height & run the required function instantly?