I've almost all my code split up in directives. This is great because the directives get very short, specific and clear about what they intend to do.
E.g. my address form is a separate directive that I nest wherever needed, e.g. the user profile form.
<form name="userform">
...some inputs...
<my-address-form my-address="user.address">
</form>
The problem is, that the address has country options, that are fetched from the server. In the case of the user this leads to two possible scenarios:
I bind the address inputs directly to the '=' scope property
<div ng-form="addressform">
<my-dropdown name="country" ng-model="myAddress.country" my-options="asyncCountries">
</div>
What then happens is that the directive gets rendered before the countries are loaded, and the dropdown is not set.
The second option is to use a separate address object in the address directive, wait for the options to to be loaded and then pass the data along. But then changes from outside of the address directive wont get reflected.
The solution to put resolve objects on my route configuration doesn't help neither, because the resolved data can't be injected into the directives (they only get injected into the controller defined in the route).
any suggestions?