I've been experimenting with angularjs and rest service calls to display specific data sets, but I'm encountering challenges with custom directives and resources.
Currently, I have a custom directive that loads a list of comments in an application. This list is loaded through a resource call and displayed using the directive on Page A.
On Page B, I display information about a single user through a URL like site.com/user/3 - this user data is fetched from a REST resource and displayed successfully as the page model.
My goal is to integrate the comments directive onto the user's page so that it shows a list of comments specific to that user. I assumed I could somehow pass the user as a filter to the directive for displaying comments.
However, this approach doesn't seem to work as expected. It appears that the directive is executed before the user data promise is fulfilled, resulting in unfiltered comments being displayed.
In essence, how can I ensure that my directive loads the filtered comments only after the user data has been completely loaded?
Just to clarify, when I mention users and comments, it's for illustrative purposes. The actual data is more domain-specific, but the concept remains the same. I haven't included any code intentionally because I want to focus on understanding the correct methodology rather than troubleshooting specific code issues.